Skip to content

Commit 3a5fc50

Browse files
authored
docs(#897): clarify authjs providers usage (next-auth@4) (#898)
1 parent d34848b commit 3a5fc50

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/guide/authjs/nuxt-auth-handler.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ The providers are the registered authentication methods that your users can use
3636

3737
You can find an overview of all the prebuilt providers [here](https://next-auth.js.org/providers/). If you want to create your own provider, please visit the [NextAuth docs](https://next-auth.js.org/configuration/providers/oauth#using-a-custom-provider).
3838

39+
::: warning
40+
`next-auth@4` providers require an additional `.default` to work in Vite. This will no longer be necessary in `next-auth@5` (`authjs`).
41+
42+
```ts
43+
import GithubProvider from 'next-auth/providers/github'
44+
45+
export default NuxtAuthHandler({
46+
providers: [
47+
// @ts-expect-error You need to use .default here for it to work during SSR. May be fixed via Vite at some point
48+
GithubProvider.default({ // [!code focus]
49+
// GitHub provider configuration
50+
})
51+
]
52+
})
53+
```
54+
:::
55+
3956
## Callbacks
4057

4158
The callbacks inside the NuxtAuthHandler are asynchronous functions that allow you to hook into and modify the authentication flow. This is helpful for when you need to:

0 commit comments

Comments
 (0)