Skip to content

Commit 508ebdd

Browse files
mnphpexpertstyxlabbalazsorban44
committed
feat(provider): add netlify (nextauthjs#555)
Co-authored-by: styxlab <[email protected]> Co-authored-by: Balázs Orbán <[email protected]>
1 parent 4c91463 commit 508ebdd

File tree

5 files changed

+51
-1
lines changed

5 files changed

+51
-1
lines changed

src/providers/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Google from './google'
1616
import IdentityServer4 from './identity-server4'
1717
import LinkedIn from './linkedin'
1818
import Mixer from './mixer'
19+
import Netlify from './netlify'
1920
import Okta from './okta'
2021
import Slack from './slack'
2122
import Spotify from './spotify'
@@ -42,6 +43,7 @@ export default {
4243
IdentityServer4,
4344
LinkedIn,
4445
Mixer,
46+
Netlify,
4547
Okta,
4648
Slack,
4749
Spotify,

src/providers/netlify.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export default (options) => {
2+
return {
3+
id: 'netlify',
4+
name: 'Netlify',
5+
type: 'oauth',
6+
version: '2.0',
7+
params: { grant_type: 'authorization_code' },
8+
accessTokenUrl: 'https://api.netlify.com/oauth/token',
9+
authorizationUrl: 'https://app.netlify.com/authorize?response_type=code',
10+
profileUrl: 'https://api.netlify.com/api/v1/user',
11+
profile: (profile) => {
12+
return {
13+
id: profile.id,
14+
name: profile.full_name,
15+
email: profile.email,
16+
image: profile.avatar_url
17+
}
18+
},
19+
...options
20+
}
21+
}

www/docs/configuration/providers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ NextAuth.js is designed to work with any OAuth service, it supports OAuth 1.0, 1
2727
* [IdentityServer4](/providers/identity-server4)
2828
* [LinkedIn](/providers/LinkedIn)
2929
* [Mixer](/providers/Mixer)
30+
* [Netlify](/providers/Netlify)
3031
* [Okta](/providers/Okta)
3132
* [Slack](/providers/slack)
3233
* [Spotify](/providers/spotify)

www/docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You can use also NextAuth.js with any database using a custom database adapter,
2323

2424
### What authentication services does NextAuth.js support?
2525

26-
NextAuth.js includes built-in support for signing in with Apple, Atlassian, Auth0, Google, Battle.net, Box, AWS Cognito, Discord, Facebook, FusionAuth, GitHub, GitLab, Google, Open ID Identity Server, Mixer, Okta, Slack, Spotify, Twitch, Twitter and Yandex.
26+
NextAuth.js includes built-in support for signing in with Apple, Atlassian, Auth0, Google, Battle.net, Box, AWS Cognito, Discord, Facebook, FusionAuth, GitHub, GitLab, Google, Open ID Identity Server, Mixer, Netlify, Okta, Slack, Spotify, Twitch, Twitter and Yandex.
2727

2828
NextAuth.js also supports email for passwordless sign in, which is useful for account recovery or for people who are not able to use an account with the configured OAuth services (e.g. due to service outage, account suspension or otherwise becoming locked out of an account).
2929

www/docs/providers/netlify.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
id: netlify
3+
title: Netlify
4+
---
5+
6+
## Documentation
7+
8+
https://www.netlify.com/blog/2016/10/10/integrating-with-netlify-oauth2/
9+
10+
## Configuration
11+
12+
https://github.com/netlify/netlify-oauth-example
13+
14+
## Example
15+
16+
```js
17+
import Providers from `next-auth/providers`
18+
...
19+
providers: [
20+
Providers.Netlify({
21+
clientId: process.env.NETLIFY_CLIENT_ID,
22+
clientSecret: process.env.NETLIFY_CLIENT_SECRET
23+
})
24+
}
25+
...
26+
```

0 commit comments

Comments
 (0)