Protected
clientProtected
optionsProtected
verifyThe authentication flow of the strategy.
This method receives the Request from the authenticator we want to authenticate.
At the end of the flow, it will return a the User data to be used by the application.
Protected
authorizationReturn extra parameters to be included in the authorization request.
Some OAuth 2.0 providers allow additional, non-standard parameters to be included when requesting authorization. Since these parameters are not standardized by the OAuth 2.0 specification, OAuth 2.0-based authentication strategies can override this function in order to populate these parameters as required by the provider.
Protected
createProtected
validateStatic
discoverDiscover the OAuth2 issuer and create a new OAuth2Strategy instance from the OIDC configuration that is returned.
This method will fetch the OIDC configuration from the issuer and create a new OAuth2Strategy instance with the provided options and verify function.
The URI of the issuer, this can be a full URL or just the domain
The rest of the options to pass to the OAuth2Strategy constructor, clientId, clientSecret, redirectURI, and scopes are required.
The verify function to use with the OAuth2Strategy instance
A new OAuth2Strategy instance
let strategy = await OAuth2Strategy.discover(
"https://accounts.google.com",
{
clientId: "your-client-id",
clientSecret: "your-client-secret",
redirectURI: "https://your-app.com/auth/callback",
scopes: ["openid", "email", "profile"],
},
async ({ tokens }) => {
return getUserProfile(tokens.access_token);
},
The name of the strategy. This will be used by the Authenticator to identify and retrieve the strategy.