Skip to content

Instantly share code, notes, and snippets.

@frankcalise
Created April 18, 2022 14:18
Show Gist options
  • Save frankcalise/0729544ed81aafe4c1c31ab50c038e2a to your computer and use it in GitHub Desktop.
Save frankcalise/0729544ed81aafe4c1c31ab50c038e2a to your computer and use it in GitHub Desktop.
const useProxyDefault = !API_CONSTANTS.PRODUCTION
const useProxy = Platform.select({ web: false, default: useProxyDefault })
const redirectUri = useProxyDefault
? AuthSession.makeRedirectUri({ useProxy })
: `scheme://yourauth0domain.us.auth0.com/${API_CONSTANTS.OS}/${API_CONSTANTS.BUNDLE_ID}/callback`
// ...
const [request, result, promptAsync] = AuthSession.useAuthRequest(
{
redirectUri,
clientId: API_CONSTANTS.AUTH0.CLIENT_ID,
// id_token will return a JWT token
responseType: 'id_token token',
// retrieve the user's profile
scopes: ['openid', 'profile', 'name', 'email'],
extraParams: {
// ideally, this will be a random value
prompt: 'login',
nonce: 'nonce',
audience: 'https://yourdomain.com/auth0-test',
},
},
{ authorizationEndpoint: API_CONSTANTS.AUTH0.AUTHORIZATION_ENDPOINT }
)
@matthops
Copy link

Thanks a ton for your help here - I assume I also need to add the expected final value from line 6 in my allowed callback URLs inside of my auth0 tenant?

@frankcalise
Copy link
Author

frankcalise commented Apr 18, 2022

Thanks a ton for your help here - I assume I also need to add the expected final value from line 6 in my allowed callback URLs inside of my auth0 tenant?

@matthops Yes that is correct, you'll make two entries one for Android and one for iOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment