Transient 401 errors for login w/ Patreon, api/oauth2/token?

Hi there, I have a “log in with Patreon” flow on my website. It works about 95% of the time, but I have random users complaining about errors connecting their Patreon. When I look at the server log, I see that the Patreon API at

api/oauth2/token?code=XXX&grant_type=authorization_code&client_id=XXX&redirect_uri=XXX

Returns a 401 error randomly for a small set of users. It seems to happen for accounts that were just recently created. It is very frustrating because there doesn’t seem to be anything I can do to fix it, other then ask to user to wait and try linking again later. Do you have any advice for how to fix this?

It happens to users that were just created at your site, or to the users that just signed up at patreon.com

Thanks, do you know how long users have to wait typically?

Users typically dont have to wait. But depending on where this issue happens, there may be pointers that could lead to the reason.

It happens in this scenario:

  1. User creates account on patreon.com
  2. User signs in on my site, connects to Patreon
  3. I call the Patreon API, it returns a 401 error. User waits a day and tries again, now the 401 error is gone.

I have more information about the issue after interviewing users.

  • It happens to both old and new Patreon accounts, so it does not appear to be related to the account age.

  • The issue it resolved after a few hours. So the API returns a 401 and the user gives up. Then, they try the OAuth flow again and it works.

  • Again, this is with this specific API:

api/oauth2/token?code=XXX&grant_type=authorization_code&client_id=XXX&redirect_uri=XXX

I see. This is likely something that occasionally happens with that specific endpoint.

Hi, after doing more investigation I am still seeing this issue.I am also seeing an issue with another endpoint:

https://www.patreon.com/api/oauth2/v2/identity?include=memberships.currently_entitled_tiers&fields[tier]=title

Where if a user pledges, it does not get updated immediately. This is making Patreon almost unusable for my site, and I am thinking of moving over to another service because of it. Please advise if there is anything I can do to make these endpoints more reliable.

Is this still happening as of this moment?

Yes, just happened 30 minutes ago. There are 2 issues:

401 error on api/oauth2/token?code=XXX&grant_type=authorization_code&client_id=XXX&redirect_uri=XXX

and

https://www.patreon.com/api/oauth2/v2/identity?include=memberships.currently_entitled_tiers&fields[tier]=title

not being up to date (e.g. not reflecting the latest memberships). It is very hard to debug since it only seems to be happening randomly.

So its not happening to all patrons? How many are potentially affected by this?