Use a Cookie object instead of SessionStorage #299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 Strategyfailure
andsuccess
methods were removed and thesuccessRedirect
andfailureRedirect
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
andCookie
types from@remix-run/server-runtime
, this will help simplify the upgrade to RRv7 and probably also support non-Remix or RR apps.