d70e61f92e
Migrate from function-based social login helpers (`facebookLogin`, `googleLogin`) to class-based services (`new FacebookLogin().signIn()`, `new GoogleLogin().signIn()`), updating call sites in `AuthFacebookPanel` and `SplashButton` with try/catch error handling. The NextAuth route handler is also refactored to the v4 pattern, importing pre-built `GET` / `POST` exports from `@/lib/auth/nextauth` instead of constructing the handler inline with `NextAuth(authOptions)`.
1.4 KiB
1.4 KiB
id, title
| id | title |
|---|---|
| cognito | Amazon Cognito |
Documentation
Configuration
https://console.aws.amazon.com/cognito/users/
You need to select your AWS region to go the the Cognito dashboard.
Options
The Amazon Cognito Provider comes with a set of default options:
You can override any of the options to suit your own use case.
Example
import CognitoProvider from "next-auth/providers/cognito";
...
providers: [
CognitoProvider({
clientId: process.env.COGNITO_CLIENT_ID,
clientSecret: process.env.COGNITO_CLIENT_SECRET,
issuer: process.env.COGNITO_ISSUER,
})
]
...
:::tip
The issuer is a URL, that looks like this: https://cognito-idp.{region}.amazonaws.com/{PoolId}
:::
PoolId is from General Settings in Cognito, not to be confused with the App Client ID.
:::warning Make sure you select all the appropriate client settings or the OAuth flow will not work. :::
:::tip
Before you can set these settings, you must set up an Amazon Cognito hosted domain. The setting can be found in App Client/Edit Hosted UI.
:::