question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I want access to the raw id_token (from the /oauth/token response). My “serverless” single-page app integrates with a third-party app that needs an oidc token, access tokens are not appropriate. I found that id_token is digested into the User object (accessible from useAuth0) but then that token is cached & inaccessible. The auth0-spa-js and auth0-react SDKs (nevermind the Auth0 dashboard & docs) don’t address this problem.

Blog articles why-should-use-accesstokens-to-secure-an-api come somewhat close, but again do not recognize that the 3rd-party Service will have the same relationship to Auth0 as Auth0 has to (e.g.) Google OAUTH. Based on an id_token, Service will establish a user and issue its own access/refresh tokens.

Describe the ideal solution

useAuth0() should provide a method to get the authenticated user’s id_token, or maybe the id_token should be a static member of the user object. (The latter might be easier and require modification in auth0-spa-js only, but I see reasons to not make that object a Christmas tree.)

Alternatives and current work-arounds

There is more than one strategy to intercept fetch/request/xhr responses, but these are not accessible to a moderately skilled frontend dev. SAML et al are not available or preferable for my intended 3rd-party Service (MongoDB Realm, btw).

Additional context

I look forward to discussion here, I’ll likely submit a PR here and/or on auth0-spa-js sometime.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
stevehobbsdevcommented, Sep 15, 2021

If that’s the supported way

@khitrenovich This is the supported way and you should continue to use __raw if you really need the raw ID token. We would not remove it without considering it a breaking change. We will also take on board the feedback to improve our docs in this area, but we’re not sure yet what form that will take.

2reactions
khitrenovichcommented, Sep 2, 2021

We had similar need, and ended up using __raw property too. If that’s the supported way, having it officially documented would be nice. If not, then we do need something supported.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are OIDC ID tokens? - Cloudentity
The ID token is the key concept in OpenID Connect (OIDC). ... and protects against the ID Token being logged and having its...
Read more >
Expose IdToken · Issue #425 · AzureAD/microsoft ... - GitHub
IdToken public and have com.microsoft.aad.msal4j. ... The code already exists in AuthenticationResult, but isn't exposed, cre... ... Expose IdToken #425.
Read more >
Authenticate with a backend server - Google Developers
Send the ID token to your server; Verify the integrity of the ID token. Using a Google API Client Library; Calling the tokeninfo...
Read more >
Understanding identity tokens - Scott Brady
A deep dive into OpenID Connect's ID token, looking at what ... chance of accidentally exposing PII to the browser history and server...
Read more >
Identity, Claims, & Tokens – An OpenID Connect Primer, Part ...
This blog series is a primer on OIDC. In this first post, we'll review some key concepts around OIDC and tokens, explained in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found