oidc-client: Using useOidcAccessToken and/or useOidcFetch not Working
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
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
returnsnull
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 33 (29 by maintainers)
Hi @radu-cs ,thank you very much! I am quite busy this week. I will take a look as soon as i can.
Yes all is the same. We’ll get back to investigating it in ~2 weeks. Thank you once again and have a nice weekend! 🙂