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

Use a Cookie object instead of SessionStorage #299

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sergiodxa
Copy link
Owner

Change how the Authenticator and Strategy classes work to use a Cookie instead of SessionStorage.

This simplifies many things in the library, since strategies uses a plain cookie to store the intermediate state they may need (like OAuth state and PKCE values), then instead of Remix Auth handling how the user data is stored in the application session, that depends on the app.

Because of that the logout method was removed, all the sessionKey, etc. options were removed, the Strategy failure and success methods were removed and the successRedirect and failureRedirect methods were removed too.

The authenticate method will now return the user data returned by the strategy verify callback, or it will throw. Here it depends on the strategy as it may only throw errors or in case of OAuth2 based strategies it may need to throw a redirect.

This also brings from another important change, as Remix Auth itself only depends on the AppLoadContext and Cookie types from @remix-run/server-runtime, this will help simplify the upgrade to RRv7 and probably also support non-Remix or RR apps.

@sergiodxa sergiodxa self-assigned this Sep 20, 2024
@sergiodxa sergiodxa added enhancement New feature or request breaking change A change introducing a breaking change labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change A change introducing a breaking change enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants