Maybe a discrepancy between tutorial and docs about 'loginWithRedirect' in auth0-spa-js

Hi all

I found the following which might be a mistake of mine or a discrepancy.

In the tutorial at in section “Login and get user info” I found the following code:

// or with promises
document.getElementById(‘login’).addEventListener(‘click’, () => {
redirect_uri: ‘http://localhost:3000/
}).then(token => {
//logged in. you can get the user profile like this:
auth0.getUser().then(user => {

I tried this in an app of mine, but sending the user and the token to the console shows “undefined”. Going to the reference document (Auth0Client | @auth0/auth0-spa-js) I found, in the last line, it Returns Promise<void>, which justifies the above inconsistency.

Am I missing something or the tutorial is wrong?

Anyway, the solution for my issue was to move the code in the “then” block after a “handleRedirectCallback” in the callback resource. No guarantee, I’m still working on it :slightly_smiling_face:.

EDIT: I forgot to mention that I was using the Brave browser (
Version 1.41.96 Chromium: 103.0.5060.114) for my tests, which seems to be significant. Using Firefox instead (V 102.0) the user information is available after the loginWithRedirect. However, the token is undefined.

EDIT and closing. Forgive me. Probably I just messed up the auth0-spa-js and auth0-llibraries. I am not able anymore to reproduce the situation.

1 Like

Hello there @augusto.ciuffoletti and welcome to the community!

Happy to hear you got this working and thank you for updating the community :smile: