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

feat: Persist provider_token to HTTPOnly cookie on SIGNED_IN #43

Merged
merged 1 commit into from
Mar 18, 2022

Conversation

Saeris
Copy link
Contributor

@Saeris Saeris commented Mar 16, 2022

Closes #40
Closes supabase/supabase#347

Adds a similar cookie persistence mechanism for provider_token to those used for access_token and refresh_token in src/nextjs/handlers/callback.ts

Additionally, this cookie is cleared on SIGNED_OUT in both src/nextjs/handlers/callback.ts and src/nextjs/handlers/logout.ts

Finally, a usage example was added to src/nextjs/README.md

Potential solution for supabase#40 and supabase/supabase#347.

Adds a similar cookie persistence mechanism for `provider_token` to those used for `access_token` and `refresh_token` in src/nextjs/handlers/callback.ts

Additionally, this cookie is cleared on SIGNED_OUT in both src/nextjs/handlers/callback.ts and src/nextjs/handlers/logout.ts

Finally, a usage example was added to src/nextjs/README.md
@thorwebdev thorwebdev changed the base branch from main to next March 18, 2022 15:28
Copy link
Member

@thorwebdev thorwebdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks 💚

@thorwebdev thorwebdev merged commit 5070916 into supabase:next Mar 18, 2022
@thorwebdev thorwebdev mentioned this pull request Mar 22, 2022
thorwebdev added a commit that referenced this pull request Mar 22, 2022
- [#44](#43): feat: Add `withMiddlewareAuthRequired` Nextjs Middleware util to protect directories.
- [#43](#43): feat: store `provider_token` in cookie.
@mikkmartin
Copy link

Thanks for this! The provider_token expires at some point. (EG i want to request provider API after a day). Is there a way to refresh it? Currently I'm forced to log out and back in to get the refreshed provider_token. Couldn't find documentation for that.

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

Successfully merging this pull request may close these issues.

Helpers for provider token User authentication on Nextjs SSR
3 participants