oidc-client-ts
oidc-client-ts copied to clipboard
Is it possible to use oidc-client-ts in service worker?
I would like to use oic-client-ts in service worker in chrome extension. Be these things throw errors(window is not existent in service worker): async signinPopupCallback(url = window.location.href, keepOpen = false) { How to fix such things?
This library only supports SSR (without a window
), but to actually authenticate a window
is required. See https://github.com/authts/oidc-client-ts/issues/256#issuecomment-992080256.
i am now closing this, if you do not agree please comment here...
I would like to see this working in service workers and chrome extensions using manifest v3 as well. Can you reopen the issue? Anything speaking against supporting this?
I am struggling with the auth in manifest v3 service worker since it was released. It would be really nice if this was supported.
We would also probably want to have a new cache option. To cache inside chrome.storage
and not window.localStorage
I am willing to work on this, but only if https://github.com/inrupt/solid-client-authn-js/issues/2202 gets resolved, otherwise it won't help my cause
For anyone wondering about MSAL, it has similar problems supporting the service worker and manifest v3 https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/3923
you can also have a look at my example repo and perhaps reuse some polyfills for window object even with this OIDC lib. https://github.com/Alino/MSAL_ChromiumExtensionSampleManifestV3
I have created a sample repo of a chrome extension using this oidc-client-ts library https://github.com/Alino/OIDC-client-ts-chromium-sample
feedback is welcome, as I would like to make this work perfectly. I think right now it does not handle token expiration. So PR are welcome.
Update: Handling token expiration fixed with https://github.com/Alino/OIDC-client-ts-chromium-sample/commit/da8525450a0ee8b6c9789f5f279f1ad944cb4889