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.

Using useOidcAccessToken and/or useOidcFetch not Working

See original GitHub issue

Issue and Steps to Reproduce

I am trying to fetch data from an API (different server that is specified in the OidcTrustedDomains.js) where the call has to be authorize using the the authorization Header with Bearer and access Token. I tried also to display the access token and the access token payload using the useOidcAccessToken hook but without success.

The hooks useOidcIdToken and useOidcUser work as expected.

Versions

  • react-oidc: 6.4.0
  • nodejs - 18.7.0
  • Firefox Developer Edition - 105.0b2
  • Microsoft Edge - 104.0.1293.63
  • Windows 10 Pro 21H2 - 19044.1889

Screenshots

image image

GET /api/v1/_**edited**_/GetD HTTP/1.1
Host: _**edited**_
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0
Accept: application/json
Accept-Language: en-US,en;q=0.8,de;q=0.5,de-DE;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: http://localhost:5500/
Origin: http://localhost:5500
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
authorization: Bearer ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER_default
Connection: keep-alive

Expected

  • The API Calls to be authorized
  • To have access to the accessTokenPayload

Actual

  • The API calls receive Error 401
  • accessTokenPayload returns null

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:31 (27 by maintainers)

github_iconTop GitHub Comments

1reaction
guillaume-chervetcommented, Sep 15, 2022

Hi @radu-cs ,thank you very much! I am quite busy this week. I will take a look as soon as i can.

1reaction
radu-cscommented, Aug 26, 2022

Yes all is the same. We’ll get back to investigating it in ~2 weeks. Thank you once again and have a nice weekend! 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · AxaGuilDEv/react-oidc
A set of react components to make Oidc (Open ID Connect) client easy. It aim to simplify OAuth authentication between multiples providers. Compatible...
Read more >
axa-fr/react-oidc
With the use of Service Worker, your tokens (refresh_token and access_token) are not accessible to the JavaScript client code (big protection ...
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