Auth0 Home Blog Docs

Problem with migration from v7 to v9

auth0
react
migration

#1

I’m doing migration from v7 to v9 of Auth0, I didn’t use redirectUri with old version.

I had this code for login:

const auth0 = new Auth0({
   clientID: CLIENT_ID,
   domain: CLIENT_DOMAIN,
   responseType: 'token'
 });

 withPromise(auth0.login.bind(auth0), {
    connection: 'db',
    sso: false,
    responseType: 'token'
    username: authCreds.email.trim(),
    password: authCreds.password.trim()
 });

and I rewrite it to:

const webAuth = new Auth0.WebAuth({
  clientID: CLIENT_ID,
  domain: CLIENT_DOMAIN,
  responseType: 'token id_token',
  redirectUri: ''
});

withPromise(webAuth.login.bind(webAuth), {
    realm: 'db',
    username: authCreds.email.trim(),
    password: authCreds.password.trim(),
    sso: false,
    redirect: false
  });

but now after login it is redirecting to https://include-staging.auth0.com/authorize?client_id=

with error: Oops!, something went wrong
server_error: Unable to issue redirect for OAuth 2.0 transaction

I do not need to use callback


#2

I believe that Auth0.js v7 used the current window location as default redirect URL while v9 does not so you’ll need to provide the redirect URL explicitly in your updated code (instead of the empty string). In addition, the login method in v9 does not receive sso or redirect options so those are being ignored and can be removed.


#3

Thanks, but previously I used this code const authResponse = yield call(Auth0.login, authCredentials); to login, and I was receiving just response from Auth0, but now it is redirection