Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#673): migrate to AuthJS #924

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
"ufo": "^1.5.4"
},
"peerDependencies": {
"next-auth": "~4.21.1"
"@auth/core": "^0.35.2"
},
"devDependencies": {
"@antfu/eslint-config": "^2.25.0",
"@auth/core": "^0.35.2",
"@nuxt/module-builder": "^0.8.3",
"@nuxt/schema": "^3.12.4",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
Expand Down
10 changes: 4 additions & 6 deletions playground-authjs/server/api/auth/[...].ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import CredentialsProvider from 'next-auth/providers/credentials'
import GithubProvider from 'next-auth/providers/github'
import CredentialsProvider from '@auth/core/providers/credentials'
import GithubProvider from '@auth/core/providers/github'
import { NuxtAuthHandler } from '#auth'

export default NuxtAuthHandler({
// a) Never hardcode your secret in your code!! and b) use a secure secret, `test-123` is **not** secure!!
secret: process.env.AUTH_SECRET ?? 'test-123',
providers: [
// @ts-expect-error You need to use .default here for it to work during SSR. May be fixed via Vite at some point
GithubProvider.default({
GithubProvider({
clientId: process.env.GITHUB_CLIENT_ID ?? 'your-client-id',
clientSecret: process.env.GITHUB_CLIENT_SECRET ?? 'your-client-secret'
}),
// @ts-expect-error You need to use .default here for it to work during SSR. May be fixed via Vite at some point
CredentialsProvider.default({
CredentialsProvider({
// The name to display on the sign in form (e.g. 'Sign in with...')
name: 'Credentials',
// The credentials is used to generate a suitable form on the sign in page.
Expand Down
Loading
Loading