sergiodxa / remix-auth

Simple Authentication for Remix
https://sergiodxa.github.io/remix-auth/
MIT License
2k stars 110 forks source link

Fix custom strategy name not being set in session #192

Closed myleslinder closed 2 years ago

myleslinder commented 2 years ago

Strategy Name Bug Fix

If a custom name was provided for a strategy when registering it with the authenticator with .use then the original strategy name would still be set in the session, as opposed to the custom name provided.

I've added name to the AuthenticateOptions and in the authenticator provide the registered strategy name to the strategy so that is what gets used in the session.

The only implication is if a strategy overrode the success method of the base Strategy class but I checked all the strategies listed in the community strategies discussion and most of them extend your Oauth2Strategy which doesn't override the success method. The only exceptions are your FormStrategy and the SupabaseStrategy which both don't override the success method and then the EmailLinkStrategy which doesn't call the method at all.

I've added an additional test to verify that it's working correctly which is passing, along with all the previous tests.

JSDoc & Type Updates