auth0-blog / nodejs-jwt-authentication-sample

A NodeJS API that supports username and password authentication with JWTs
MIT License
688 stars 267 forks source link

UnauthorizedError: jwt issuer invalid. expected: undefined #32

Closed dmongit closed 7 years ago

dmongit commented 7 years ago

I followed instructions, and even tried changes shown in issue #30 because I was initially receiving the invalid audience error. Now I'm getting the invalid issuer error when I authenticate and try to hit a protected API. I'm using this example for my app: https://auth0.com/blog/adding-authentication-to-react-native-using-jwt/

Sign up and Login seem to work (aside from errors when I try to sign up the same user twice and try to login twice).

Any ideas?

I think the only difference is that my react-native app that uses this API as an end point fetches with my local IP instead of localhost.

Thanks!

dmongit commented 7 years ago

I'm not entirely sure how I resolved this. But, I got it working so it looks like it was something on my end. I changed the issuer to anything else. I changed my issuer to http://something.com and my username and password are both something in the user object. I'm not 100% if I changed anything else relevant b/c I was multitasking.

josephkandi commented 5 years ago

I get the same error. The error will go away when i remove the issuer. Is the issuer not supposed to be validated as well?

dearamerican commented 4 years ago

Have the same question! Is the issuer not supposed to be validated? Works for me when I remove it, but that doesn't seem like it should be the solution?

dearamerican commented 4 years ago

Ah, here it is: issuer should be

`https://${process.env.AUTH0_DOMAIN}/`

if you just put ${process.env.AUTH0_DOMAIN} it will remain broken.

stephanebruckert commented 4 years ago

In my case I forgot .eu in my domain name

Nabhag8848 commented 1 year ago

Ah, here it is: issuer should be

`https://${process.env.AUTH0_DOMAIN}/`

if you just put ${process.env.AUTH0_DOMAIN} it will remain broken.

Thanks @dearamerican it worked