Getting 401 error for v2 identity request with all tokens except for mine

I’m helping someone with their Patreon integration, and I’m trying to see if a user on our website is patron of the creator I’m helping
I’m using this request

GET /api/oauth2/v2/identity HTTP/1.1
Host: www.patreon.com
Authorization: Bearer <token here>
cache-control: no-cache

The request throws 401’s on every requests except for requests on my own account (the one that owns the client registered with the API)

I’m using the scopes identity.memberships

Am I using the API wrong?

Hi can I get the request id for the request you’re making? It’ll be the id field in the response.

Here is the id field
b3e66089-cc7c-407d-b8f0-c6edfc02fd2a

Hi,

Did you get a chance to look at the request from the id?

I am also having this issue. I can log in successfully only if I use my personal account. If I use another account, someone that also Pledges, I get invalid_grant. I’m using PHP API v2.

Hi @lcontant,

Thanks for your patience. I looked into the request - you’re requesting for user 13092443, but the token is for user 880399090.

For every user you want to request information for, you have to have that user go through the OAuth flow and get a token specific to them. Then you should be able to make requests for their information.

@maty if you can send me your id, I can look into what’s going on for you as well.

Hope this helps! Let me know if you have any further questions :slight_smile:

Evy
Platform Engineer

Hi @evy,

The token used for the API was obtained with the AOuth flow. The identity request doesn’t explicitly specify a user. From my understanding, the token supplied determines the user for which the information is requested. As a result, I don’t understand what you mean by requesting the for the wrong user.
Can you explain a bit further?

Hi @lcontant,

Sorry yes that is correct (I’m new on the platform team, learning more about our API as well! :sweat_smile:)

What I have learned is you need the identity scope. identity.memberships is specifically for memberships things and if you wanted to see memberships you’d need both identity and identity.memberships. Let me know if that works!

Thanks for your patience and hope that helps,
Evy