Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use oidc-client-ts in service worker? #398

Closed
kostia-lev opened this issue Feb 28, 2022 · 7 comments
Closed

Is it possible to use oidc-client-ts in service worker? #398

kostia-lev opened this issue Feb 28, 2022 · 7 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@kostia-lev
Copy link

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?

@pamapa
Copy link
Member

pamapa commented Mar 1, 2022

This library only supports SSR (without a window), but to actually authenticate a window is required. See #256 (comment).

@pamapa pamapa added the question Further information is requested label Mar 1, 2022
@pamapa
Copy link
Member

pamapa commented Mar 7, 2022

i am now closing this, if you do not agree please comment here...

@pamapa pamapa closed this as completed Mar 7, 2022
@angelo-v
Copy link

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?

@Alino
Copy link

Alino commented Jul 15, 2022

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

@angelo-v
Copy link

I am willing to work on this, but only if inrupt/solid-client-authn-js#2202 gets resolved, otherwise it won't help my cause

@Alino
Copy link

Alino commented Aug 17, 2022

For anyone wondering about MSAL, it has similar problems supporting the service worker and manifest v3
AzureAD/microsoft-authentication-library-for-js#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

@Alino
Copy link

Alino commented Sep 5, 2022

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 Alino/OIDC-client-ts-chromium-sample@da85254

@pamapa pamapa closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants