oidc-client
oidc-client copied to clipboard
renewTokens is missing in new version 6.0.13
Issue and Steps to Reproduce
useOidc
Hook doesnt have a renewTokens
method. I need it for refresh token when getting 401 status code error
This hook should be merged in this PR https://github.com/AxaGuilDEv/react-oidc/pull/778
Versions
6.0.13
Screenshots
Expected
Expected to be exported in useOidc hook
Actual
Additional Details
- Installed packages:
Hi @0ctav0 , thank you for your issue. You use case interrested me to rebuild this method in v6. Why do you need to renew? Do you need token renew or silent token renew? I want to rebuild it cleanly. Do you need to update extra when you renew?
I have cleanner silent renew it will be easier to rebuild it cleanly now.
Regards
Yes I need silent token renew. Honestly I dont know what is extra?
Hi @0ctav0 , silent signing occurs automaticaly in background before tokens expires.
You do not need to manage anything once you are login in.
No I have to. I can have situations when by some reason token becomes invalid, which this library can not detect in all possible situations, so I need to manualy renew token when getting 401 error.
In v3 there was a way to manualy renew tokens. It was helpful and works fine, but since updating to v4, v5 this is headeache, my application becomes unstable in way of authorization and token management. I had to update this library from v3 to v5 because I had to update to react v18 :)
Hi @0ctav0 , i may need more information about your pro lin order to help you. Like code sample or something else. You do not need to manage token renew in v6. It is done automaticaly.
Seems that auto renewal works only based on expiration time.
But there is much more reasons for 401.
For example, some of api returns 401 with error Bearer error="invalid_token", error_description="The signature key was not found"
if identity server resets.
Next token is ok, so if we can renew token when api tell us that token invalid (because of any reason) - there is no problem.
Token is invalid - ok, we are getting another one and we are good.
At v3 it was possible. Starting with v4 there is no such method.
Can you suggest some solution/workaround for our problem?
I will set up the method for your use case
On monday
Version 6.3.0 set up renewTokens() method again :)
Does it work for your use case @0ctav0 @NZainchkovskiy ?
I will add possibility to update "extras" in another PullRequest.
@guillaume-chervet Yes, thank you so much!
Hi @0ctav0 @NZainchkovskiy may I close this Pull Request? Thank you very much for the issue ans feedback :)
Hi @0ctav0 @NZainchkovskiy may I close this Pull Request? Thank you very much for the issue ans feedback :)
Sure, yes. Thank you for your incredible work!
@guillaume-chervet Thank you for introducing this feature back! It will be very helpful for implementing the re-fetch of the token when the user switches back to the tab. However, occasionally I've been noticing timeouts coming from oidc.ts file.
The timeout setting for oidc silent renew that I used in configuration is 15 seconds. I wonder what could possibly affect my configuration that it wouldn't reach the Identity server? Besides, does the renewTokens return a promise which has the new token?
hi @tielushko , sorry I missed your message. This error happen in general when computer is in sleep mode or reconeccting from a VPN.
Do you have more information about the context of when and why it happen?
Hi @0ctav0 , i close the issue. Thank you very much for it. Feel free to reopen it if you needed it.