Issue with Auth0 Login Using Custom Domain

We are encountering an issue while logging in through Auth0 using a custom domain. The login flow initiates correctly, but upon redirection, the session values are coming back as null.

We are using the following code snippet to configure Auth0 WebAuth:

export const webAuthDragonApp = (config: AuthEnvironmentVariables) => {

const domain = config[‘NEXT_PUBLIC_AUTH0_DOMAIN’];

const clientID = config[‘NEXT_PUBLIC_CLIENT_AUTH0_CLIENT_ID’];

const redirectUri = config[‘NEXT_PUBLIC_CLIENT_AUTH0_LOGIN_REDIRECT_URL’];

const responseType = config[‘NEXT_PUBLIC_RESPONSE_TYPE’];

if (!domain || !clientID || !redirectUri || !responseType) {

return null;

}

return new WebAuth({

domain,

clientID,

redirectUri,

responseType,

overrides: {

  __tenant: 'dev', // Your actual Auth0 tenant name

  __token_issuer: '<My Custom Domain>/' 

}

});

};

Hi @vikash.jain

Welcome to the Auth0 Community!

Can you try to initialize the WebAuth without overriding the internal parameters? I suspect that they may be causing the issue with the session value. Here you can find the minimal setup → https://auth0.com/docs/libraries/auth0js#initialization

If your Auth.js will need to make a call to the Management API, you will need to initialize the new webAuth0 instance pointing to the Auth0 Domain not the custom one → https://auth0.com/docs/libraries/auth0js#user-management

Thanks
Dawid

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.