-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider): finish Reddit provider and add documentation (#1094)
* Create reddit.md * uncommented profile callback * Update reddit.md * fix lint issues * added reddit provider * added reddit provider * Add Reddit Provider For some reason a bunch of providers got deleted in the last commit * Add Reddit Provider * Add Reddit Provider
- Loading branch information
Showing
6 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
id: reddit | ||
title: Reddit | ||
--- | ||
|
||
## Documentation | ||
|
||
https://www.reddit.com/dev/api/ | ||
|
||
## Configuration | ||
|
||
https://www.reddit.com/prefs/apps/ | ||
|
||
## Example | ||
|
||
```js | ||
import Providers from `next-auth/providers` | ||
... | ||
providers: [ | ||
Providers.Reddit({ | ||
clientId: process.env.REDDIT_CLIENT_ID, | ||
clientSecret: process.env.REDDIT_CLIENT_SECRET | ||
}) | ||
} | ||
... | ||
``` | ||
|
||
:::warning | ||
Reddit requires authorization every time you go through their page. | ||
::: | ||
|
||
:::warning | ||
Only allows one callback URL per Client ID / Client Secret. | ||
::: | ||
|
||
:::tip | ||
This Provider template only has a one hour access token to it and only has the 'identity' scope. If you want to get a refresh token as well you must follow this: | ||
|
||
```js | ||
providers: [ | ||
{ | ||
id: "reddit", | ||
name: "Reddit", | ||
clientId: process.env.REDDIT_CLIENT_ID, | ||
clientSecret: process.env.REDDIT_CLIENT_SECRET, | ||
scope: "identity mysubreddits read", //Check Reddit API Documentation for more. The identity scope is required. | ||
type: "oauth", | ||
version: "2.0", | ||
params: { grant_type: "authorization_code" }, | ||
accessTokenUrl: " https://www.reddit.com/api/v1/access_token", | ||
authorizationUrl: | ||
"https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent", | ||
profileUrl: "https://oauth.reddit.com/api/v1/me", | ||
profile: (profile) => { | ||
return { | ||
id: profile.id, | ||
name: profile.name, | ||
email: null, | ||
} | ||
} | ||
} | ||
] | ||
``` | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters