Auth0 Home Blog Docs

Exchange Facebook token for Auth0 JWT

I’ve got a react-native app and I’ve integrated the Facebook SDK. I’d like to use native apps to authenticate users and get an access token first, then exchange that token with Auth0 for an Auth0 created JWT.

Is this possible?

1 Like

Hi, @geofflancaster!

Thank you for reaching out to us.

That’s the flow to get an access token, the users need to authenticate first.

Third-party Access Tokens are issued by Identity Providers after a user authenticates with that provider. Use the Access Tokens to call the API of the third-party provider that issued them. For example, an Access Token issued after authentication to Facebook could be used to call the Facebook Graph API.

The user authenticates with the IdP by making an HTTP GET call to the /api/v2/user/{user-id} endpoint. To call this endpoint you need a Access Tokens for the Management API that includes the read:user_idp_tokens scope. The Access Token for the IdP will be available in the identities array, under the element for the particular connection. For information on how to call an IdP API, see Call an Identity Provider API.

Validating tokens: If you have received an Access Token from an Identity Provider (IdP), in general, you don’t need to validate it. You can pass it to the issuing IdP, and the IdP takes care of the rest.

Please let me know if this information is helpful!