Nodejs config - Getting an invalid token sent in /callback

I’ve got a new nodejs app running, and I want to use auth0 for authorization.

I’m getting to the auth0 page, and selecting a google account.

The user is being registered as being logged on correctly in the Auth0 admin page.

When my callback is called (/auth_callback), it has a code and state query param, but when it goes through passport, and the Auth0Strategy strategy, I get a Token Error. I’m sure I have everything set up correctly.

I’m running localhost without SSL.
Nodejs - 14.7.0
Passport - 0.4.1
passport-auth0 - 1.3.3

It’s a regular multi-page app.

I am creating the auth0 scope as “openid email profile”.

1 Like

Hi @andrew.oxenburgh,

Welcome to the Community!

What is the full error? And what does the token look like?

Let me know,
Dan

Hi Dan,

The req to my callback looks like this:

/auth_callback?code=Fc0ZVeEi0OA-Jre2&state=annbv1Ev02LyrCoReHDUeohm

It’s a GET.

====

The stack in the browser after the error looks like:

TokenError: Unauthorized
    at Strategy.OAuth2Strategy.parseErrorResponse (/Users/andrew/dev/THREAM/thream/node_modules/passport-oauth2/lib/strategy.js:358:12)
    at Strategy.OAuth2Strategy._createOAuthError (/Users/andrew/dev/THREAM/thream/node_modules/passport-oauth2/lib/strategy.js:405:16)
    at /Users/andrew/dev/THREAM/thream/node_modules/passport-oauth2/lib/strategy.js:175:45
    at /Users/andrew/dev/THREAM/thream/node_modules/oauth/lib/oauth2.js:191:18
    at passBackControl (/Users/andrew/dev/THREAM/thream/node_modules/oauth/lib/oauth2.js:132:9)
    at IncomingMessage.<anonymous> (/Users/andrew/dev/THREAM/thream/node_modules/oauth/lib/oauth2.js:157:7)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1244:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

The response created by passport looks like:

"{\"error\":\"access_denied\",\"error_description\":\"Unauthorized\"}"

I’m just connecting with localhost.

I’m using Charles, and I can’t see any more requests going out at this point.

Can you check the error in your auth0 logs and see if there is more info? Also, can you DM me the name of your tenant?

Thanks,
Dan

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