I did some research and it works for me.
Solution
- Need to use
audience
- Configuration in my angular app. All the keys are case sensitive.
{
clientID: <your_client_id>',
domain: '<your.auth0.com>',
audience: 'https://<your.auth0.com>/api/v2/',
redirect: 'http://localhost:4200/callback',
logoutRedirect: 'http://localhost:4200',
scope: 'openid profile email'
}
Notes
- If you want access token as JWT then you must have to set
audience
. - Set APIs
https://<your.auth0.com>/api/v2/
in audience as given above example. Userinfo endpoint not working for me. - In the URL
/
is required at last.https://<your.auth0.com>/api/v2/
- Node side JWT verification
const authCheck = jwt({
secret: jwks.expressJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri: 'https://<your.auth0.com>/.well-known/jwks.json'
}),
// This is the identifier we set when we created the API
audience: 'https://<your.auth0.com>/api/v2/',
issuer: 'https://<your.auth0.com>/',
algorithms: ['RS256']
});
- In the URL
/
is required at last.https://<your.auth0.com>/api/v2/
andhttps://<your.auth0.com>/
I’ve update code in my github. Github: GitHub - kdhttps/auth0-angular-node: Auth0 authentication with Angular and NodeJS