-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
2,436 additions
and
1,479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template> | ||
<div> | ||
<h1>Authjs provider</h1> | ||
<div> | ||
<h3>Status</h3> | ||
<pre>Status: {{ status }}</pre> | ||
<pre>Session: {{ data ?? 'no session data' }}</pre> | ||
</div> | ||
<div> | ||
<h3>Actions</h3> | ||
<button @click="signIn('github')">sign in github</button> | ||
<br /> | ||
<button @click="signIn(undefined)">sign in</button> | ||
<br /> | ||
<button @click="signIn('no-provider')">no provider</button> | ||
<br /> | ||
<button @click="signOut()">sign out</button> | ||
</div> | ||
{{ sessionData }} | ||
<nuxt-page></nuxt-page> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
const { status, data, signIn, signOut } = useAuth() | ||
|
||
const { data: sessionData } = useFetch('/api/session') | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default defineNuxtConfig({ | ||
devtools: { enabled: true }, | ||
modules: ['../src/module'], | ||
auth: { | ||
baseURL: 'http://localhost:3000/api/auth', | ||
provider: { | ||
type: 'authjs', | ||
}, | ||
globalAppMiddleware: true, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "playground-authjs", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev": "nuxi dev", | ||
"build": "nuxi build", | ||
"generate": "nuxi generate" | ||
}, | ||
"devDependencies": { | ||
"nuxt": "latest" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div></div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import GitHub from '@auth/core/providers/github' | ||
import type { AuthConfig } from '@auth/core/types' | ||
|
||
import { NuxtAuthHandler } from '#auth' | ||
|
||
export const options: AuthConfig = { | ||
secret: 'NtoBpkbWs4uTqsEvBJ/UyvWGFYAXQ9/tdNrmQCf7NIQ=', | ||
providers: [ | ||
GitHub({ | ||
clientId: '10b3f386a001067199c0', | ||
clientSecret: '85bca5873bed7f8744d88917e639518a3cbc3b90', | ||
}), | ||
], | ||
} | ||
|
||
export default NuxtAuthHandler(options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { options } from './auth/[...]' | ||
import { getServerSession, getServerToken } from '#auth' | ||
|
||
export default defineEventHandler(async (event) => { | ||
const session = await getServerSession(event) | ||
const token = await getServerToken(event, options) | ||
|
||
return { | ||
session, | ||
token, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "./.nuxt/tsconfig.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.