mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Merge branch 'main' of github.com:nextauthjs/next-auth
This commit is contained in:
37
docs/docs/providers/pinterest.md
Normal file
37
docs/docs/providers/pinterest.md
Normal 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
|
||||
:::
|
||||
34
packages/next-auth/src/providers/pinterest.ts
Normal file
34
packages/next-auth/src/providers/pinterest.ts
Normal 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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user