AxaFrance / oidc-client

Light, Secure, Pure Javascript OIDC (Open ID Connect) Client. We provide also a REACT wrapper (compatible NextJS, etc.).
MIT License
572 stars 151 forks source link

Weird issues in making service worker implementation working (Struggling since long) #1283

Closed pgangwani closed 4 months ago

pgangwani commented 5 months ago

Issue and Steps to Reproduce

I added oidcTrustedDomain setting to convert already working on service worker (web storage) approach for my enterprise application

Versions

"@axa-fr/react-oidc": "^7.15.4"

Screenshots

Screenshot 2024-02-05 at 11 09 01 PM Screenshot 2024-02-05 at 11 02 18 PM

Screenshot 2024-02-05 at 11 14 01 PM Screenshot 2024-02-05 at 11 13 46 PM

Expected

Service worker implementation should be working properly

Actual

Getting many weird issues, unable to even refresh the page.

Additional Details

I think its even not able to initialize

pgangwani commented 5 months ago

hi @guillaume-chervet , Greetings!! I know you must be busy. I am struggling since long to get service worker approach initialized.

May I get your few minutes to review where and what I am doing wrong.

guillaume-chervet commented 5 months ago

Hi @pgangwani ,

Thank you for your issue :)

Do you have the content of your trustedDomains files? it seem to be an error from that file.

Here bellow the trustedDomain file from the demo : https://github.com/AxaFrance/oidc-client/blob/main/examples/react-oidc-demo/public/OidcTrustedDomains.js

pgangwani commented 5 months ago

Screenshot 2024-02-06 at 2 07 27 AM

Sure @guillaume-chervet please check the screenshot

guillaume-chervet commented 5 months ago

Hi @pgangwani , i will try tomorrow morning to setup a case like you did in the demo. It is possible that it is a bug.

pgangwani commented 5 months ago

Sure. Additionally, I would like to know that if in case service worker works with low confidence and we get any issue in app where we decide to turn off the service worker. Is there unRegisteration of service worker happens automatically ? or this is a feature request.

pgangwani commented 5 months ago

This issue is fixed by taking the latest oidc-sw & trusteddomain and replacing with above trustedomain. Not sure what suddently changed between 7.3.x to 7.15.

Also how to switch safely betweeen service woeker vs non service worker & vice versa by cleaning up/unregistering service worker

pgangwani commented 5 months ago

@guillaume-chervet As I said , somehow I was able to make default working but non default is not working. You might want to try in your sandbox once. For some reason I m not able to get repo working to test example like sandbox the way I am doing in real app. Hope you can provide insights !

guillaume-chervet commented 5 months ago

Hi @pgangwani , I'am not sure to understand your new problem? May you have more code example and details ?

if you use a specific configuration name, you have to set the configuration name in each components to rebranch to the correct configuration.

pgangwani commented 5 months ago

Hi @pgangwani , I'am not sure to understand your new problem? May you have more code example and details ?

if you use a specific configuration name, you have to set the configuration name in each components to rebranch to the correct configuration.

yes I did change in all the components like oidcprovider, useoidc oidcsecure etc

guillaume-chervet commented 5 months ago

Hi @pgangwani do you have more information to share innorder to be able to help you?

pgangwani commented 4 months ago

We can close this. #1299 will cover some cleanup concerns and its discussion.