Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

How to encode to abc.xyz.def instead of Bearer #157

Closed
opyate opened this issue Jun 14, 2017 · 3 comments
Closed

How to encode to abc.xyz.def instead of Bearer #157

opyate opened this issue Jun 14, 2017 · 3 comments

Comments

@opyate
Copy link

opyate commented Jun 14, 2017

I'm following this example: https://auth0.com/docs/quickstart/spa/angularjs/03-calling-an-api
and the Authorization header looks like this:

Authorization: Bearer NzmWR9AfD40PEYfC

...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 an encode function anywhere (as opposed to the decode which accepts this shape).

@chenkie
Copy link
Contributor

chenkie commented Jun 15, 2017

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

@opyate
Copy link
Author

opyate commented Jun 15, 2017

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

@opyate opyate closed this as completed Jun 15, 2017
@chenkie
Copy link
Contributor

chenkie commented Jun 15, 2017

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 :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants