You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: www/docs/configuration/callbacks.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ The documentation below shows how to implement each callback, their default beha
38
38
39
39
Use the `signIn()` callback to control if a user is allowed to sign in.
40
40
41
-
```js title="pages/api/auth/[...nextauth.js]"
41
+
```js title="pages/api/auth/[...nextauth].js"
42
42
callbacks: {
43
43
/**
44
44
* @param{object}user User object
@@ -88,7 +88,7 @@ The redirect callback is called anytime the user is redirected to a callback URL
88
88
89
89
By default only URLs on the same URL as the site are allowed, you can use the redirect callback to customise that behaviour.
90
90
91
-
```js title="pages/api/auth/[...nextauth.js]"
91
+
```js title="pages/api/auth/[...nextauth].js"
92
92
callbacks: {
93
93
/**
94
94
* @param{string}url URL provided as callback URL by the client
@@ -117,7 +117,7 @@ e.g. `getSession()`, `useSession()`, `/api/auth/session`
117
117
* When using database sessions, the User object is passed as an argument.
118
118
* When using JSON Web Tokens for sessions, the JWT payload is provided instead.
119
119
120
-
```js title="pages/api/auth/[...nextauth.js]"
120
+
```js title="pages/api/auth/[...nextauth].js"
121
121
callbacks: {
122
122
/**
123
123
* @param{object}session Session object
@@ -157,7 +157,7 @@ e.g. `/api/auth/signin`, `getSession()`, `useSession()`, `/api/auth/session`
157
157
158
158
The contents *user*, *account*, *profile* and *isNewUser* will vary depending on the provider and on if you are using a database or not. If you want to pass data such as User ID, OAuth Access Token, etc. to the browser, you can persist it in the token and use the `session()` callback to return it.
Copy file name to clipboardexpand all lines: www/docs/configuration/providers.md
+7-4
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,15 @@ id: providers
3
3
title: Providers
4
4
---
5
5
6
-
Authentication Providers in NextAuth.js are how you define services can be used to sign in.
6
+
Authentication Providers in NextAuth.js are how you define services that can be used to sign in.
7
7
8
-
NextAuth.js is designed to work with any OAuth service, it supports OAuth 1.0, 1.0A and 2.0 and has built-in support for many popular OAuth sign-in services. It also supports email / passwordless authentication.
8
+
This includes, OAuth, email / passwordless and other other services.
9
9
10
10
## Sign in with OAuth
11
11
12
-
### Built-in providers
12
+
NextAuth.js is designed to work with any OAuth service, it supports OAuth 1.0, 1.0A and 2.0 and has built-in support for many popular OAuth sign-in services.
13
+
14
+
### Built-in OAuth providers
13
15
14
16
*[Apple](/providers/apple)
15
17
*[Atlassian](/providers/atlassian)
@@ -20,6 +22,7 @@ NextAuth.js is designed to work with any OAuth service, it supports OAuth 1.0, 1
20
22
*[Amazon Cognito](/providers/cognito)
21
23
*[Discord](/providers/discord)
22
24
*[Facebook](/providers/facebook)
25
+
*[FusionAuth](/providers/fusionauth)
23
26
*[GitHub](/providers/github)
24
27
*[GitLab](/providers/gitlab)
25
28
*[Google](/providers/google)
@@ -33,7 +36,7 @@ NextAuth.js is designed to work with any OAuth service, it supports OAuth 1.0, 1
33
36
*[Twitter](/providers/twitter)
34
37
*[Yandex](/providers/yandex)
35
38
36
-
### Using a built-in provider
39
+
### Using a built-in OAuth provider
37
40
38
41
1. Register your application at the developer portal of your provider. There are links above to the developer docs for most supported providers with details on how to register your application.
Copy file name to clipboardexpand all lines: www/docs/getting-started/example.md
+12-12
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
---
2
2
id: example
3
-
title: Example
3
+
title: Example Code
4
4
---
5
5
6
-
### Check out the example project
6
+
##Get started with NextAuth.js
7
7
8
-
The easiest way to get started is to clone the [example application](https://github.com/iaincollins/next-auth-example) and follow the instructions in the [README](https://github.com/iaincollins/next-auth-example/blob/main/README.md).
8
+
The example code below describes to add authentication to a Next.js app.
9
9
10
-
You can find a live demo of the example project at [next-auth-example.now.sh](https://next-auth-example.now.sh)
11
-
12
-
## Add to an existing project
13
-
14
-
*The example code below shows how to add authentication to an existing Next.js project.*
10
+
:::tip
11
+
The easiest way to get started is to clone the [example app](https://github.com/iaincollins/next-auth-example) and follow the instructions in README.md. You can try out a live demo at [next-auth-example.now.sh](https://next-auth-example.now.sh)
12
+
:::
15
13
16
14
### Add API route
17
15
18
16
To add NextAuth.js to a project create a file called `[...nextauth].js` in `pages/api/auth`.
19
17
18
+
[Read more about how to add authentication providers.](/configuration/providers)
@@ -68,13 +68,11 @@ export default function Page() {
68
68
}
69
69
```
70
70
71
-
***That's all the code you need to add authentication with NextAuth.js to a project!***
72
-
73
71
:::tip
74
72
You can use the `useSession` hook from anywhere in your application (e.g. in a header component).
75
73
:::
76
74
77
-
### Add to all pages
75
+
### Add session state
78
76
79
77
To allow session state to be shared between pages - which improves performance, reduces network traffic and avoids component state changes while rendering - you can use the NextAuth.js Provider in `pages/_app.js`.
Check out the [client documentation](/getting-started/client) to see how you can improve the user experience and page performance by using the NextAuth.js client.
95
93
:::
96
94
97
-
### Deploying
95
+
### Deploying to production
98
96
99
97
When deploying your site set the `NEXTAUTH_URL` environment variable to the canonical URL of the website.
0 commit comments