Compare commits

...

3 Commits

Author SHA1 Message Date
Balázs Orbán
0eb4159737 fix(ts): fix updateSession return type 2021-04-28 22:23:13 +02:00
Balázs Orbán
9f0008375f fix(ts): fix createVerificationRequest type (#1877) 2021-04-28 22:16:09 +02:00
leeoocca
0cf1823e70 docs: fix typos in custom provider page (#1875)
* fix typo on custom provider options table

* fix typo in custom provider code example
2021-04-28 20:49:27 +02:00
3 changed files with 17 additions and 11 deletions

10
types/adapters.d.ts vendored
View File

@@ -49,9 +49,15 @@ export interface AdapterInstance<U = User, P = Profile, S = Session> {
): Promise<void>
createSession(user: U): Promise<S>
getSession(sessionToken: string): Promise<S | null>
updateSession(session: S, force?: boolean): Promise<S>
updateSession(session: S, force?: boolean): Promise<S | null>
deleteSession(sessionToken: string): Promise<void>
createVerificationRequest?: SendVerificationRequest
createVerificationRequest?(
identifier: string,
url: string,
token: string,
secret: string,
provider: EmailConfig & { maxAge: number; from: string }
): Promise<void>
getVerificationRequest?(
identifier: string,
verificationToken: string,

12
types/providers.d.ts vendored
View File

@@ -133,13 +133,13 @@ export interface EmailConfigServerOptions {
}
}
export type SendVerificationRequest = (
identifier: string,
url: string,
baseUrl: string,
token: string,
export type SendVerificationRequest = (params: {
identifier: string
url: string
baseUrl: string
token: string
provider: EmailConfig
) => Awaitable<void>
}) => Awaitable<void>
export interface EmailConfig extends CommonProviderOptions {
type: "email"

View File

@@ -76,7 +76,7 @@ As an example of what this looks like, this is the provider object returned for
profileUrl: "https://www.googleapis.com/oauth2/v1/userinfo?alt=json",
async profile(profile, tokens) {
// You can use the tokens, in case you want to fetch more profile information
// For example several OAuth provider does not return e-mail by default.
// For example several OAuth providers do not return email by default.
// Depending on your provider, will have tokens like `access_token`, `id_token` and or `refresh_token`
return {
id: profile.id,
@@ -131,7 +131,7 @@ providers: [
| requestTokenUrl | Endpoint to retrieve a request token | `string` | No |
| authorizationParams | Additional params to be sent to the authorization endpoint | `object` | No |
| profileUrl | Endpoint to retrieve the user's profile | `string` | No |
| profile | An callback returning an object with the user's info | `object` | No |
| profile | A callback returning an object with the user's info | `object` | No |
| idToken | Set to `true` for services that use ID Tokens (e.g. OpenID) | `boolean` | No |
| headers | Any headers that should be sent to the OAuth provider | `object` | No |
| protection | Additional security for OAuth login flows (defaults to `state`) |`[pkce]`,`[state]`,`[pkce,state]`| No |
@@ -233,4 +233,4 @@ If you think your custom provider might be useful to others, we encourage you to
That's it! 🎉 Others will be able to discover this provider much more easily now!
You can look at the existing built-in providers for inspiration.
You can look at the existing built-in providers for inspiration.