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.
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
The JSDoc comments in the authenticator were out of date so I updated them.
I updated the private properties of Authenticator to use types from the AuthenticatorOptions as opposed to using them from AuthenticateOptions
Similar to the update with the sessionErrorKey value in my previous PR, I have set the sessionStrategyKey in AuthenticateOptions to be required as it is always set. I have also removed the fallback values in the case it was undefined (which it never could be).
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 theAuthenticateOptions
and in theauthenticator
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 yourOauth2Strategy
which doesn't override thesuccess
method. The only exceptions are your FormStrategy and the SupabaseStrategy which both don't override thesuccess
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
AuthenticatorOptions
as opposed to using them fromAuthenticateOptions
sessionErrorKey
value in my previous PR, I have set thesessionStrategyKey
inAuthenticateOptions
to be required as it is always set. I have also removed the fallback values in the case it was undefined (which it never could be).logout
returns aPromise<never>