Interface: CredentialsConfig<CredentialsInputs>
providers/credentials.CredentialsConfig
The Credentials Provider needs to be configured.
Type parameters​
Name | Type |
---|---|
CredentialsInputs | extends Record <string , CredentialInput > = Record <string , CredentialInput > |
Hierarchy​
↳
CredentialsConfig
Properties​
authorize​
• authorize: (credentials
: undefined
| Record
<keyof CredentialsInputs
, string
>, request
: Request
) => Awaitable
<null
| User
>
Type declaration​
â–¸ (credentials
, request
): Awaitable
<null
| User
>
Gives full control over how you handle the credentials received from the user.
danger
There is no validation on the user inputs by default, so make sure you do so by a popular library like Zod
Example
//...
async authorize(, request) {
const response = await fetch(request)
if(!response.ok) return null
return await response.json() ?? null
}
//...
##### Parameters
| Name | Type | Description |
| :------ | :------ | :------ |
| `credentials` | `undefined` \| `Record`<keyof `CredentialsInputs`, `string`\> | See [CredentialInput](providers_credentials.CredentialInput) |
| `request` | [`Request`]( https://developer.mozilla.org/en-US/docs/Web/API/Request ) | The original request is forward for convenience |
##### Returns
`Awaitable`<``null`` \| [`User`](types.User)\>
___
### id
• **id**: `string`
Uniquely identifies the provider in AuthConfig.providers
It's also part of the URL
#### Inherited from
[CommonProviderOptions](providers.CommonProviderOptions).[id](providers.CommonProviderOptions#id)
___
### name
• **name**: `string`
The provider name used on the default sign-in page's sign-in button.
For example if it's "Google", the corresponding button will say:
"Sign in with Google"
#### Inherited from
[CommonProviderOptions](providers.CommonProviderOptions).[name](providers.CommonProviderOptions#name)