Skip to content

Commit 66db563

Browse files
authored
docs(provider): link to providers' source code (#1955)
1 parent 9619077 commit 66db563

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+534
-162
lines changed

www/docs/providers/42.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ https://api.intra.42.fr/apidoc/guides/web_application_flow
1111

1212
https://profile.intra.42.fr/oauth/applications/new
1313

14+
## Options
15+
16+
The **42 School Provider** comes with a set of default options:
17+
18+
- [42 School Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/42.js)
19+
20+
You can override any of the options to suit your own use case.
21+
1422
## Example
1523

1624
```js

www/docs/providers/apple.md

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ https://developer.apple.com/sign-in-with-apple/get-started/
1111

1212
https://developer.apple.com/account/resources/identifiers/list/serviceId
1313

14+
## Options
15+
16+
The **Apple Provider** comes with a set of default options:
17+
18+
- [Apple Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/apple.js)
19+
20+
You can override any of the options to suit your own use case.
21+
1422
## Example
1523

1624
There are two ways you can use the Sign in with Apple provider.
@@ -25,7 +33,7 @@ import Providers from `next-auth/providers`
2533
providers: [
2634
Providers.Apple({
2735
clientId: process.env.APPLE_ID,
28-
clientSecret: {
36+
clientSecret: {
2937
teamId: process.env.APPLE_TEAM_ID,
3038
privateKey: process.env.APPLE_PRIVATE_KEY,
3139
keyId: process.env.APPLE_KEY_ID,
@@ -40,18 +48,18 @@ providers: [
4048
You can convert your Apple key to a single line to use it in a environment variable.
4149

4250
**Mac**
43-
51+
4452
```bash
4553
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' AuthKey_ID.k8
4654
```
47-
55+
4856
**Windows**
49-
57+
5058
```powershell
5159
$k8file = "AuthKey_ID.k8"
52-
(Get-Content "C:\Users\$env:UserName\Downloads\${k8file}") -join "\n"
60+
(Get-Content "C:\Users\$env:UserName\Downloads\${k8file}") -join "\n"
5361
```
54-
62+
5563
:::
5664

5765
### Pre-generated secret
@@ -92,9 +100,9 @@ Apple doesn't allow you to use localhost in domains or subdomains.
92100

93101
The following guides may be helpful:
94102

95-
* [How to setup localhost with HTTPS with a Next.js app](https://medium.com/@anMagpie/secure-your-local-development-server-with-https-next-js-81ac6b8b3d68)
103+
- [How to setup localhost with HTTPS with a Next.js app](https://medium.com/@anMagpie/secure-your-local-development-server-with-https-next-js-81ac6b8b3d68)
96104

97-
* [Guide to configuring Sign in with Apple](https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple)
105+
- [Guide to configuring Sign in with Apple](https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple)
98106

99107
### Example server
100108

@@ -114,7 +122,6 @@ Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "127.0.0.1`tdev.e
114122

115123
#### Create certificate
116124

117-
118125
Creating a certificate for localhost is easy with openssl . Just put the following command in the terminal. The output will be two files: localhost.key and localhost.crt.
119126

120127
```bash
@@ -127,7 +134,7 @@ openssl req -x509 -out localhost.crt -keyout localhost.key \
127134
:::tip
128135
**Windows**
129136

130-
The OpenSSL executable is distributed with [Git](https://git-scm.com/download/win]9) for Windows.
137+
The OpenSSL executable is distributed with [Git](https://git-scm.com/download/win]9) for Windows.
131138
Once installed you will find the openssl.exe file in `C:/Program Files/Git/mingw64/bin` which you can add to the system PATH environment variable if it’s not already done.
132139

133140
Add environment variable `OPENSSL_CONF=C:/Program Files/Git/mingw64/ssl/openssl.cnf`
@@ -142,32 +149,30 @@ Add environment variable `OPENSSL_CONF=C:/Program Files/Git/mingw64/ssl/openssl.
142149

143150
Create directory `certificates` and place `localhost.key` and `localhost.crt`
144151

145-
146152
You can create a `server.js` in the root of your project and run it with `node server.js` to test Sign in with Apple integration locally:
147153

148-
149154
```js
150-
const { createServer } = require('https')
151-
const { parse } = require('url')
152-
const next = require('next')
153-
const fs = require('fs')
155+
const { createServer } = require("https")
156+
const { parse } = require("url")
157+
const next = require("next")
158+
const fs = require("fs")
154159

155-
const dev = process.env.NODE_ENV !== 'production'
160+
const dev = process.env.NODE_ENV !== "production"
156161
const app = next({ dev })
157162
const handle = app.getRequestHandler()
158163

159164
const httpsOptions = {
160-
key: fs.readFileSync('./certificates/localhost.key'),
161-
cert: fs.readFileSync('./certificates/localhost.crt')
165+
key: fs.readFileSync("./certificates/localhost.key"),
166+
cert: fs.readFileSync("./certificates/localhost.crt"),
162167
}
163168

164169
app.prepare().then(() => {
165170
createServer(httpsOptions, (req, res) => {
166171
const parsedUrl = parse(req.url, true)
167172
handle(req, res, parsedUrl)
168-
}).listen(3000, err => {
173+
}).listen(3000, (err) => {
169174
if (err) throw err
170-
console.log('> Ready on https://localhost:3000')
175+
console.log("> Ready on https://localhost:3000")
171176
})
172177
})
173178
```
@@ -177,25 +182,28 @@ app.prepare().then(() => {
177182
If you want to pre-generate your secret, this is an example of the code you will need:
178183

179184
```js
180-
const jwt = require('jsonwebtoken')
181-
const fs = require('fs')
185+
const jwt = require("jsonwebtoken")
186+
const fs = require("fs")
182187

183-
const appleId = 'myapp.example.com'
184-
const keyId = ''
185-
const teamId = ''
186-
const privateKey = fs.readFileSync('path/to/key')
188+
const appleId = "myapp.example.com"
189+
const keyId = ""
190+
const teamId = ""
191+
const privateKey = fs.readFileSync("path/to/key")
187192

188193
const secret = jwt.sign(
189194
{
190195
iss: teamId,
191196
iat: Math.floor(Date.now() / 1000),
192-
exp: Math.floor(Date.now() / 1000) + ( 86400 * 180 ), // 6 months
193-
aud: 'https://appleid.apple.com',
194-
sub: appleId
195-
}, privateKey, {
196-
algorithm: 'ES256',
197-
keyid: keyId
198-
})
197+
exp: Math.floor(Date.now() / 1000) + 86400 * 180, // 6 months
198+
aud: "https://appleid.apple.com",
199+
sub: appleId,
200+
},
201+
privateKey,
202+
{
203+
algorithm: "ES256",
204+
keyid: keyId,
205+
}
206+
)
199207

200208
console.log(secret)
201209
```

www/docs/providers/atlassian.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ title: Atlassian
77

88
https://developer.atlassian.com/cloud/jira/platform/oauth-2-authorization-code-grants-3lo-for-apps/#implementing-oauth-2-0--3lo-
99

10+
## Options
11+
12+
The **Atlassian Provider** comes with a set of default options:
13+
14+
- [Atlassian Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/atlassian.js)
15+
16+
You can override any of the options to suit your own use case.
17+
1018
## Example
1119

1220
```js

www/docs/providers/auth0.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ https://manage.auth0.com/dashboard
1515
Configure your application in Auth0 as a 'Regular Web Application' (not a 'Single Page App').
1616
:::
1717

18+
## Options
19+
20+
The **Auth0 Provider** comes with a set of default options:
21+
22+
- [Auth0 Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/auth0.js)
23+
24+
You can override any of the options to suit your own use case.
25+
1826
## Example
1927

2028
```js
@@ -32,4 +40,4 @@ providers: [
3240

3341
:::note
3442
`domain` should be the fully qualified domain – e.g. `dev-s6clz2lv.eu.auth0.com`
35-
:::
43+
:::

www/docs/providers/azure-ad-b2c.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-c
1111

1212
https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant
1313

14+
## Options
15+
16+
The **Azure Active Directory Provider** comes with a set of default options:
17+
18+
- [Azure Active Directory Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/azure-ad-b2c.js)
19+
20+
You can override any of the options to suit your own use case.
21+
1422
## Example
23+
1524
- In https://portal.azure.com/ -> Azure Active Directory create a new App Registration.
1625
- Make sure to remember / copy
1726
- Application (client) ID
@@ -22,13 +31,13 @@ https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tena
2231
In `.env.local` create the follwing entries:
2332

2433
```
25-
AZURE_CLIENT_ID=<copy Application (client) ID here>
34+
AZURE_CLIENT_ID=<copy Application (client) ID here>
2635
AZURE_CLIENT_SECRET=<copy generated secret value here>
2736
AZURE_TENANT_ID=<copy the tenant id here>
2837
```
2938

3039
In `pages/api/auth/[...nextauth].js` find or add the AZURE entries:
31-
40+
3241
```js
3342
import Providers from 'next-auth/providers';
3443
...

www/docs/providers/basecamp.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,18 @@ https://github.com/basecamp/api/blob/master/sections/authentication.md
1111

1212
https://launchpad.37signals.com/integrations
1313

14+
## Options
15+
16+
The **Basecamp Provider** comes with a set of default options:
17+
18+
- [Basecamp Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/basecamp.js)
19+
20+
You can override any of the options to suit your own use case.
21+
1422
## Examples
1523

1624
### Basic profile information
25+
1726
```js
1827
import Providers from `next-auth/providers`
1928
...
@@ -27,7 +36,7 @@ providers: [
2736
```
2837

2938
:::note
30-
Using the example above, it is only possible to retrieve profile information such as account id, email and name. If you wish to retrieve user data in relation to a specific team, you must provide a different profileUrl and a custom function to handle profile information as shown in the example below.
39+
Using the example above, it is only possible to retrieve profile information such as account id, email and name. If you wish to retrieve user data in relation to a specific team, you must provide a different profileUrl and a custom function to handle profile information as shown in the example below.
3140
:::
3241

3342
### Profile information in relation to specific team
@@ -57,4 +66,4 @@ providers: [
5766

5867
:::tip
5968
The BASECAMP_TEAM_ID is found in the url path of your team's homepage. For example, if the url is `https://3.basecamp.com/1234567/projects`, then in this case the BASECAMP_TEAM_ID is 1234567
60-
:::
69+
:::

www/docs/providers/battlenet.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ https://develop.battle.net/documentation/guides/using-oauth
1111

1212
https://develop.battle.net/access/clients
1313

14+
## Options
15+
16+
The **Battle.net Provider** comes with a set of default options:
17+
18+
- [Battle.net Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/battlenet.js)
19+
20+
You can override any of the options to suit your own use case.
21+
1422
## Example
1523

1624
```js

www/docs/providers/box.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ https://developer.box.com/reference/
1111

1212
https://developer.box.com/guides/sso-identities-and-app-users/connect-okta-to-app-users/configure-box/
1313

14+
## Options
15+
16+
The **Box Provider** comes with a set of default options:
17+
18+
- [Box Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/box.js)
19+
20+
You can override any of the options to suit your own use case.
21+
1422
## Example
1523

1624
```js

0 commit comments

Comments
 (0)