Closed opyate closed 7 years ago
it looks like the issue is that you're getting an opaque access token instead of a JWT access token from Auth0. angular-jwt doesn't actually come into play for that since it's Auth0 that is issuing the tokens.
Can you open an issue here with some more description including your WebAuth
configuration?
Thanks
Thanks for the reply!
I simply have to change this line to get id_token
from localStorage instead of the opaque access_token
:
https://github.com/auth0-samples/auth0-angularjs-samples/blob/a28650bd2b6ce227f2ef73c5f9679c8bab1b4bb7/03-Calling-an-API/app/app.js#L65
ID tokens aren't meant to be sent to APIs, you do need to send the access token. The issue is likely that API authorization for your app isn't configured correctly which is why you were getting an opaque access token and not a JWT. If you open another issue here we can figure out what's going on :)
I'm following this example: https://auth0.com/docs/quickstart/spa/angularjs/03-calling-an-api and the Authorization header looks like this:
...but it is incompatible with the Python Flask backend example here: https://auth0.com/docs/quickstart/backend/python/01-authorization
...which expect the token to be in the
abc.xyz.def
shape.How do I get
angular-jwt
to get the token into the said shape? I couldn't see anencode
function anywhere (as opposed to thedecode
which accepts this shape).