Merge branch 'main' of github.com:nextauthjs/next-auth

This commit is contained in:
Balázs Orbán
2022-10-10 00:30:25 +02:00
2 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
---
id: pinterest
title: Pinterest
---
## Documentation
https://developers.pinterest.com/docs/getting-started/authentication/
## Configuration
https://developers.pinterest.com/apps/
## Options
The **Pinterest Provider** comes with a set of default options:
- [Pinterest Provider options](https://github.com/nextauthjs/next-auth/blob/main/packages/next-auth/src/providers/pinterest.ts)
You can override any of the options to suit your own use case.
## Example
```ts
import PinterestProvider from "next-auth/providers/pinterest"
...
providers: [
PinterestProvider({
clientId: process.env.PINTEREST_ID,
clientSecret: process.env.PINTEREST_SECRET
})
]
...
:::tip
To use in production, make sure the app has standard API access and not trial access
:::

View File

@@ -0,0 +1,34 @@
import { OAuthConfig, OAuthUserConfig } from "."
export interface PinterestProfile extends Record<string, any> {
account_type: "BUSINESS" | "PINNER"
profile_image: string
website_url: string
username: string
}
export default function PinterestProvider<P extends PinterestProfile>(
options: OAuthUserConfig<P>
): OAuthConfig<P> {
return {
id: "pinterest",
name: "Pinterest",
type: "oauth",
authorization: {
url: "https://www.pinterest.com/oauth",
params: { scope: "user_accounts:read" },
},
checks: ["state"],
token: "https://api.pinterest.com/v5/oauth/token",
userinfo: "https://api.pinterest.com/v5/user_account",
profile({ username, profile_image }) {
return {
id: username,
name: username,
image: profile_image,
email: null,
}
},
options,
}
}