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

How to specify for {provider} to return a refresh_token? #46

Open
Darko opened this issue Jun 3, 2024 · 1 comment
Open

How to specify for {provider} to return a refresh_token? #46

Darko opened this issue Jun 3, 2024 · 1 comment

Comments

@Darko
Copy link

Darko commented Jun 3, 2024

First of all, great library! Think I've gone bald trying to figure out google auth from inside a worker.

2nd, when I perform the auth flow, google does not return a refresh_token alongside the id_token and the rest of the payload.
How would I go about specifying that I want a refresh token to be returned?

@plutonium-239
Copy link

Hi
#42 had fixed this but there is no way to access it directly because there have been no new releases since an year.

This adds an accessType to the options while calling redirect. By default this is set to online, which doesn't return a refresh token. You can set it to offline to make it return one.

Ultimately,

await google.redirect({
    options: {
         ...
+        accessType: "offline"
    }
});

As a workaround, you can do

npm install git+https://github.com/subhendukundu/worker-auth-providers.git

to manually build the latest version from github.
Note that you will need yarn and git, although only for the build process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants