Authenticate with OAuth

OAuth requires a callback URL to be set during the authentication flow that matches a route in your frontend. You can set this programmatically in your client-side JavaScript to always redirect to the deployment that requested authentication (either FeaturePeek or your production site).

While each FeaturePeek deployment has its own dynamic URL, the domain of the underlying frame remains consistent across deployments. If you cannot set your callback URL programmatically (for example, if your OAuth provider requires you set the value in its web interface), you can find your project's origin URI in its project settings.

origin uri

Be sure to add this domain to your OAuth tenant's Allowed Domains list.

Auth0

Here's a code snippet of how to dynamically set the redirect URI when using Auth0's auth0.js library.

const auth = new auth0.WebAuth({
domain: AUTH0_CLIENT_DOMAIN,
clientID: AUTH0_CLIENT_ID,
redirectUri: `${document.location.origin}/callback`,
responseType: 'token id_token',
scope: 'openid',
})