Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonce does not match #288

Closed
yageek opened this issue Jan 5, 2017 · 0 comments
Closed

Nonce does not match #288

yageek opened this issue Jan 5, 2017 · 0 comments

Comments

@yageek
Copy link

yageek commented Jan 5, 2017

Using the 8.0.1 version, I always get a Nonce does not match error when
parsing the token returned by redirect.loginWithCredentials.

The issue occurs inside a VueJS2 app.

I have an authentication file creating a client:

const auth0 = new Auth0.WebAuth({
  domain: process.env.AUTH0_DOMAIN,
  clientID: process.env.AUTH0_CLIENT_ID,
  responseType: 'token',
  redirectUri: window.location.origin + '/'
})

// login
let login = (username, password) => {
  auth0.redirect.loginWithCredentials({
    connection: 'Username-Password-Authentication',
    email: username,
    password: password,
    scope: 'openid email'
  },
  function (err) {
    if (err) console.error('something went wrong: ' + err.message)
  })
}

When the application is called back, I try to get read the provided token:

let requiresAuth = (to, from, next) => {
  if (!checkAuth()) {
    console.log('auth failed ...')
    let result = auth0.parseHash(window.location.hash, (err, data) => {
      console.log(err || data, window.location.hash)
    })
    console.log('Result:')
    console.dir(result)
    if (result && result.idToken) {
      console.log('Authentication succeeded')
      localStorage.setItem(ID_TOKEN_KEY, result.idToken)
      next({path: '/'})
    } else {
      console.log('Redirect to login...')
      next({path: '/login'})
    }
  } else {
    next()
  }
}

The complete app can be found here: https://github.com/vitactiv/vitactiv-admin/tree/version/lock

EDIT: Seems that the README has an error. By checking in the code of the transaction Manager, responseType should match id_token and not token as written in the README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant