interface ConstructorOptions {
    clientId: string;
    cookie?: string | Omit<SetCookieInit, "value"> & { name: string };
    fetch?: FetchLike;
    issuer: string;
    provider?: string;
    redirectUri: string;
}

Properties

clientId: string

The client ID of the application you registered in the OpenAuth server.

"my-client-id"
cookie?: string | Omit<SetCookieInit, "value"> & { name: string }

The name of the cookie used to keep state and code verifier around.

The OAuth2 flow requires generating a random state and code verifier, and then checking that the state matches when the user is redirected back to the application. This is done to prevent CSRF attacks.

The state and code verifier are stored in a cookie, and this option allows you to customize the name of that cookie if needed.

"oauth2"
fetch?: FetchLike

A custom fetch implementation to use when making requests to the OAuth2 server. This can be useful when you need to replace the default fetch to use a proxy, for example.

issuer: string

The issuer of the OpenAuth server you want to use. This is where your OpenAuth server is hosted.

"https://openauth.example.com"
provider?: string

The identity provider already configured in your OpenAuth server you want to send the user to.

This can't be changed after the strategy is created, if you have more than one provider create multiple instances of your strategy.

authenticator.use(
new OpenAuthStrategy(
{
redirectURI,
clientID,
issuer,
provider: "google" // Set it to Google
},
verify
),
"google" // Rename the strategy to Google
)
authenticator.use(
new OpenAuthStrategy(
{
redirectURI,
clientID,
issuer,
provider: "github" // Set it to GitHub
},
verify
),
"github" // Rename the strategy to GitHub
)
redirectUri: string

The redirect URI of the application you registered in the OpenAuth server.

This is where the user will be redirected after they authenticate.

"https://example.com/auth/callback"