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

Move oauthTokens out of Session and make available via a new onSuccess option #154

Conversation

mthadley
Copy link
Contributor

This follows the pattern that was recently introduced in workos/authkit-remix#33:

Instead of storing these tokens in the session, this branch proposes making them only available as part of the initial > callback. Developers who need access to the underlying OAuth provider's tokens and API will be responsible for persisting them in their own data store for later usage.

The equivalent usage with workos/authkit-next looks like this:

import { handleAuth } from '@workos-inc/authkit-nextjs';

export const GET = handleAuth({
  onSuccess: async ({ oauthTokens }) => {
    await saveTokens(oauthTokens);
  },
});

Copy link

linear bot commented Dec 17, 2024

Copy link
Contributor

@PaulAsjes PaulAsjes left a comment

Choose a reason for hiding this comment

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

Looks good, just some wordsmithing.

README.md Outdated Show resolved Hide resolved
Co-authored-by: Paul Asjes <[email protected]>
@mthadley mthadley merged commit 565f393 into main Dec 19, 2024
@mthadley mthadley deleted the feature/auth-4012-move-oauthtokens-out-of-authkit-next-session-cookie branch December 19, 2024 23:34
@mthadley mthadley mentioned this pull request Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants