CognitoProvider
Reference doc for the `CognitoProvider`.
Use this provider to authenticate with a Cognito OAuth endpoint.
import { CognitoProvider } from "@openauthjs/openauth/provider/cognito"
export default issuer({ providers: { cognito: CognitoProvider({ domain: "your-domain.auth.us-east-1.amazoncognito.com", region: "us-east-1", clientID: "1234567890", clientSecret: "0987654321" }) }})
Methods
CognitoProvider
CognitoProvider(config)
Parameters
The config for the provider.config
CognitoConfig
Returns Provider
Create a Cognito OAuth2 provider.
CognitoProvider({ domain: "your-domain.auth.us-east-1.amazoncognito.com", region: "us-east-1", clientID: "1234567890", clientSecret: "0987654321"})
CognitoConfig
CognitoConfig.clientID
Type string
The client ID.
This is just a string to identify your app.
{ clientID: "my-client"}
CognitoConfig.clientSecret
Type string
The client secret.
This is a private key that’s used to authenticate your app. It should be kept secret.
{ clientSecret: "0987654321"}
CognitoConfig.domain
Type string
The domain of the Cognito User Pool.
{ domain: "your-domain.auth.us-east-1.amazoncognito.com"}
CognitoConfig.pkce?
Type boolean
Default false
Whether to use PKCE (Proof Key for Code Exchange) for the authorization code flow. Some providers like x.com require this.
CognitoConfig.query?
Type Record
<
string
, string
>
Any additional parameters that you want to pass to the authorization endpoint.
{ query: { access_type: "offline", prompt: "consent" }}
CognitoConfig.region
Type string
The region the Cognito User Pool is in.
{ region: "us-east-1"}
CognitoConfig.scopes
Type string
[]
A list of OAuth scopes that you want to request.
{ scopes: ["email", "profile"]}