mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
16 Commits
@auth/core
...
@auth/svel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6ac48314e | ||
|
|
f8675bc245 | ||
|
|
3d4842dcc9 | ||
|
|
7d7d1b2f80 | ||
|
|
9a4f3db7b0 | ||
|
|
6aad07a95c | ||
|
|
cfed5b976f | ||
|
|
d34108091f | ||
|
|
7bf79b89a8 | ||
|
|
4cd688703a | ||
|
|
57b176840e | ||
|
|
6298d955df | ||
|
|
2ad1cb3f8c | ||
|
|
98707282eb | ||
|
|
f4a2430891 | ||
|
|
575bcb5710 |
@@ -4,11 +4,8 @@ import * as github from "@actions/github"
|
|||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import * as core from "@actions/core"
|
import * as core from "@actions/core"
|
||||||
import { readFileSync } from "node:fs"
|
import { readFileSync } from "node:fs"
|
||||||
import { join } from "node:path"
|
|
||||||
|
|
||||||
const addReproductionLabel = "incomplete"
|
const addReproductionLabel = "incomplete"
|
||||||
const __dirname =
|
|
||||||
"/home/runner/work/nextauthjs/next-auth/.github/actions/issue-validator"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{
|
* @typedef {{
|
||||||
@@ -73,7 +70,7 @@ async function run() {
|
|||||||
}),
|
}),
|
||||||
client.issues.createComment({
|
client.issues.createComment({
|
||||||
...issueCommon,
|
...issueCommon,
|
||||||
body: readFileSync(join(__dirname, "repro.md"), "utf8"),
|
body: readFileSync("repro.md", "utf8"),
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
return core.info(
|
return core.info(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
GITHUB_CLIENT_ID=
|
GITHUB_ID=
|
||||||
GITHUB_CLIENT_SECRET=
|
GITHUB_SECRET=
|
||||||
NEXTAUTH_SECRET=
|
# On UNIX systems you can use `openssl rand -hex 32` or
|
||||||
PUBLIC_NEXTAUTH_URL=http://localhost:5173
|
# https://generate-secret.vercel.app/32 to generate a secret.
|
||||||
|
AUTH_SECRET=
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
{
|
{
|
||||||
"useTabs": true,
|
"semi": false,
|
||||||
"singleQuote": true,
|
"plugins": ["prettier-plugin-svelte"],
|
||||||
"trailingComma": "none",
|
"pluginSearchDirs": ["."],
|
||||||
"printWidth": 100,
|
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
||||||
"plugins": ["prettier-plugin-svelte"],
|
|
||||||
"pluginSearchDirs": ["."],
|
|
||||||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,23 @@
|
|||||||
{
|
{
|
||||||
"name": "sveltekit-nextauth",
|
"scripts": {
|
||||||
"private": true,
|
"dev": "vite dev",
|
||||||
"version": "0.0.1",
|
"build": "vite build",
|
||||||
"scripts": {
|
"preview": "vite preview",
|
||||||
"dev": "vite dev",
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||||
"build": "vite build",
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
||||||
"preview": "vite preview",
|
},
|
||||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
"devDependencies": {
|
||||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
|
"@sveltejs/adapter-auto": "next",
|
||||||
},
|
"@sveltejs/kit": "next",
|
||||||
"devDependencies": {
|
"svelte": "3.55.0",
|
||||||
"@fontsource/fira-mono": "^4.5.10",
|
"svelte-check": "2.10.2",
|
||||||
"@neoconfetti/svelte": "^1.0.0",
|
"typescript": "4.9.4",
|
||||||
"@sveltejs/adapter-auto": "next",
|
"vite": "4.0.1"
|
||||||
"@sveltejs/kit": "next",
|
},
|
||||||
"@types/cookie": "^0.5.1",
|
"dependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
"cookie": "0.5.0",
|
||||||
"@typescript-eslint/parser": "^5.45.0",
|
"@auth/core": "workspace:*",
|
||||||
"eslint": "^8.28.0",
|
"@auth/sveltekit": "workspace:*"
|
||||||
"eslint-config-prettier": "^8.5.0",
|
},
|
||||||
"eslint-plugin-svelte3": "^4.0.0",
|
"type": "module"
|
||||||
"prettier": "^2.8.0",
|
|
||||||
"prettier-plugin-svelte": "^2.8.1",
|
|
||||||
"svelte": "^3.54.0",
|
|
||||||
"svelte-check": "^2.9.2",
|
|
||||||
"tslib": "^2.4.1",
|
|
||||||
"typescript": "^4.9.3",
|
|
||||||
"vite": "^4.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"cookie": "0.5.0",
|
|
||||||
"@auth/core": "workspace:*",
|
|
||||||
"@auth/sveltekit": "workspace:^"
|
|
||||||
},
|
|
||||||
"type": "module"
|
|
||||||
}
|
}
|
||||||
|
|||||||
33
apps/playground-sveltekit/src/app.d.ts
vendored
33
apps/playground-sveltekit/src/app.d.ts
vendored
@@ -1,32 +1 @@
|
|||||||
/// <reference types="@sveltejs/kit" />
|
/// <reference types="@auth/sveltekit" />
|
||||||
/// <reference types="next-auth-sveltekit" />
|
|
||||||
import type {
|
|
||||||
User as NextAuthUser,
|
|
||||||
Session as NextAuthSession,
|
|
||||||
} from "next-auth"
|
|
||||||
|
|
||||||
// optionally extend the `user`
|
|
||||||
interface User extends NextAuthUser {
|
|
||||||
// add custom fields here
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AppSession extends NextAuthSession {
|
|
||||||
user: User
|
|
||||||
}
|
|
||||||
|
|
||||||
// See https://kit.svelte.dev/docs/typescript
|
|
||||||
// for information about these interfaces
|
|
||||||
declare global {
|
|
||||||
declare namespace App {
|
|
||||||
interface Locals {
|
|
||||||
// session: AppSession
|
|
||||||
getSession: () => Promise<AppSession>
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Platform {}
|
|
||||||
|
|
||||||
interface Session extends AppSession {}
|
|
||||||
|
|
||||||
interface Stuff {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width" />
|
||||||
|
%sveltekit.head%
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="utf-8" />
|
<div>%sveltekit.body%</div>
|
||||||
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
|
</body>
|
||||||
<meta name="viewport" content="width=device-width" />
|
</html>
|
||||||
%sveltekit.head%
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div>%sveltekit.body%</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|||||||
@@ -1,25 +1,7 @@
|
|||||||
import SvelteKitAuth from "@auth/sveltekit"
|
import SvelteKitAuth from "@auth/sveltekit"
|
||||||
import GitHub from '@auth/core/providers/github';
|
import GitHub from "@auth/core/providers/github"
|
||||||
import Google from '@auth/core/providers/google';
|
import { GITHUB_ID, GITHUB_SECRET } from "$env/static/private"
|
||||||
import Credentials from '@auth/core/providers/credentials';
|
|
||||||
import {
|
|
||||||
GITHUB_CLIENT_ID,
|
|
||||||
GITHUB_CLIENT_SECRET,
|
|
||||||
GOOGLE_CLIENT_ID,
|
|
||||||
GOOGLE_CLIENT_SECRET,
|
|
||||||
} from "$env/static/private"
|
|
||||||
|
|
||||||
export const handle = SvelteKitAuth({
|
export const handle = SvelteKitAuth({
|
||||||
providers: [
|
providers: [GitHub({ clientId: GITHUB_ID, clientSecret: GITHUB_SECRET })],
|
||||||
GitHub({ clientId: GITHUB_CLIENT_ID, clientSecret: GITHUB_CLIENT_SECRET }),
|
})
|
||||||
Google({ clientId: GOOGLE_CLIENT_ID, clientSecret: GOOGLE_CLIENT_SECRET }),
|
|
||||||
Credentials({
|
|
||||||
credentials: { password: { label: "Password", type: "password" } },
|
|
||||||
async authorize(credentials) {
|
|
||||||
if (credentials.password !== "pw") return null
|
|
||||||
return { name: "Fill Murray", email: "bill@fillmurray.com", image: "https://www.fillmurray.com/64/64", id: "1", foo: "" }
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
debug: true,
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let provider: any;
|
export let provider: any
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form action={provider.signinUrl} method="POST">
|
<form action={provider.signinUrl} method="POST">
|
||||||
{#if provider.callbackUrl}
|
{#if provider.callbackUrl}
|
||||||
<input type="hidden" name="callbackUrl" value={provider.callbackUrl} />
|
<input type="hidden" name="callbackUrl" value={provider.callbackUrl} />
|
||||||
{/if}
|
{/if}
|
||||||
<button type="submit" class="button">
|
<button type="submit" class="button">
|
||||||
<slot>Sign in with {provider.name}</slot>
|
<slot>Sign in with {provider.name}</slot>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,14 +1,7 @@
|
|||||||
import type { LayoutServerLoad } from "./$types"
|
import type { LayoutServerLoad } from "./$types"
|
||||||
|
|
||||||
export const load: LayoutServerLoad = (event) => {
|
export const load: LayoutServerLoad = async (event) => {
|
||||||
console.log('layout server load', event.locals.getSession)
|
|
||||||
let session
|
|
||||||
if (event.locals.getSession)
|
|
||||||
{
|
|
||||||
session = event.locals.getSession()
|
|
||||||
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
session,
|
session: await event.locals.getSession(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,144 +1,151 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/stores';
|
import { page } from "$app/stores"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<header>
|
<header>
|
||||||
<div class="signedInStatus">
|
<div class="signedInStatus">
|
||||||
<p class="nojs-show loaded">
|
<p class="nojs-show loaded">
|
||||||
{#if Object.keys($page.data.session || {}).length}
|
{#if $page.data.session}
|
||||||
{#if $page.data.session.user.image}
|
{#if $page.data.session.user?.image}
|
||||||
<span style="background-image: url('{$page.data.session.user.image}')" class="avatar" />
|
<span
|
||||||
{/if}
|
style="background-image: url('{$page.data.session.user.image}')"
|
||||||
<span class="signedInText">
|
class="avatar"
|
||||||
<small>Signed in as</small><br />
|
/>
|
||||||
<strong>{$page.data.session.user.email || $page.data.session.user.name}</strong>
|
{/if}
|
||||||
</span>
|
<span class="signedInText">
|
||||||
<a href="/auth/signout" class="button">Sign out</a>
|
<small>Signed in as</small><br />
|
||||||
{:else}
|
<strong
|
||||||
<span class="notSignedInText">You are not signed in</span>
|
>{$page.data.session.user?.email ??
|
||||||
<a href="/auth/signin" class="buttonPrimary">Sign in</a>
|
$page.data.session.user?.name}</strong
|
||||||
{/if}
|
>
|
||||||
</p>
|
</span>
|
||||||
</div>
|
<a href="/auth/signout" class="button">Sign out</a>
|
||||||
<nav>
|
{:else}
|
||||||
<ul class="navItems">
|
<span class="notSignedInText">You are not signed in</span>
|
||||||
<li class="navItem"><a href="/">Home</a></li>
|
<a href="/auth/signin" class="buttonPrimary">Sign in</a>
|
||||||
<li class="navItem"><a href="/protected">Protected</a></li>
|
{/if}
|
||||||
</ul>
|
</p>
|
||||||
</nav>
|
</div>
|
||||||
</header>
|
<nav>
|
||||||
<slot />
|
<ul class="navItems">
|
||||||
|
<li class="navItem"><a href="/">Home</a></li>
|
||||||
|
<li class="navItem"><a href="/protected">Protected</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
:global(body) {
|
:global(body) {
|
||||||
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
||||||
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
"Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
|
||||||
'Segoe UI Symbol', 'Noto Color Emoji';
|
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
|
||||||
padding: 0 1rem 1rem 1rem;
|
"Noto Color Emoji";
|
||||||
max-width: 680px;
|
padding: 0 1rem 1rem 1rem;
|
||||||
margin: 0 auto;
|
max-width: 680px;
|
||||||
background: #fff;
|
margin: 0 auto;
|
||||||
color: #333;
|
background: #fff;
|
||||||
}
|
color: #333;
|
||||||
:global(li),
|
}
|
||||||
:global(p) {
|
:global(li),
|
||||||
line-height: 1.5rem;
|
:global(p) {
|
||||||
}
|
line-height: 1.5rem;
|
||||||
:global(a) {
|
}
|
||||||
font-weight: 500;
|
:global(a) {
|
||||||
}
|
font-weight: 500;
|
||||||
:global(hr) {
|
}
|
||||||
border: 1px solid #ddd;
|
:global(hr) {
|
||||||
}
|
border: 1px solid #ddd;
|
||||||
:global(iframe) {
|
}
|
||||||
background: #ccc;
|
:global(iframe) {
|
||||||
border: 1px solid #ccc;
|
background: #ccc;
|
||||||
height: 10rem;
|
border: 1px solid #ccc;
|
||||||
width: 100%;
|
height: 10rem;
|
||||||
border-radius: 0.5rem;
|
width: 100%;
|
||||||
filter: invert(1);
|
border-radius: 0.5rem;
|
||||||
}
|
filter: invert(1);
|
||||||
|
}
|
||||||
|
|
||||||
.nojs-show {
|
.nojs-show {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
.signedInStatus {
|
.signedInStatus {
|
||||||
display: block;
|
display: block;
|
||||||
min-height: 4rem;
|
min-height: 4rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.loaded {
|
.loaded {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 0;
|
top: 0;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 0 0 0.6rem 0.6rem;
|
border-radius: 0 0 0.6rem 0.6rem;
|
||||||
padding: 0.6rem 1rem;
|
padding: 0.6rem 1rem;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background-color: rgba(0, 0, 0, 0.05);
|
background-color: rgba(0, 0, 0, 0.05);
|
||||||
transition: all 0.2s ease-in;
|
transition: all 0.2s ease-in;
|
||||||
}
|
}
|
||||||
.signedInText,
|
.signedInText,
|
||||||
.notSignedInText {
|
.notSignedInText {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
padding-top: 0.8rem;
|
padding-top: 0.8rem;
|
||||||
left: 1rem;
|
left: 1rem;
|
||||||
right: 6.5rem;
|
right: 6.5rem;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: inherit;
|
display: inherit;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
line-height: 1.3rem;
|
line-height: 1.3rem;
|
||||||
}
|
}
|
||||||
.signedInText {
|
.signedInText {
|
||||||
padding-top: 0rem;
|
padding-top: 0rem;
|
||||||
left: 4.6rem;
|
left: 4.6rem;
|
||||||
}
|
}
|
||||||
.avatar {
|
.avatar {
|
||||||
border-radius: 2rem;
|
border-radius: 2rem;
|
||||||
float: left;
|
float: left;
|
||||||
height: 2.8rem;
|
height: 2.8rem;
|
||||||
width: 2.8rem;
|
width: 2.8rem;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
.button,
|
.button,
|
||||||
.buttonPrimary {
|
.buttonPrimary {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: -0.4rem;
|
margin-right: -0.4rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
border-radius: 0.3rem;
|
border-radius: 0.3rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 1.4rem;
|
line-height: 1.4rem;
|
||||||
padding: 0.7rem 0.8rem;
|
padding: 0.7rem 0.8rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
.buttonPrimary {
|
.buttonPrimary {
|
||||||
background-color: #346df1;
|
background-color: #346df1;
|
||||||
border-color: #346df1;
|
border-color: #346df1;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
padding: 0.7rem 1.4rem;
|
padding: 0.7rem 1.4rem;
|
||||||
}
|
}
|
||||||
.buttonPrimary:hover {
|
.buttonPrimary:hover {
|
||||||
box-shadow: inset 0 0 5rem rgba(0, 0, 0, 0.2);
|
box-shadow: inset 0 0 5rem rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
.navItems {
|
.navItems {
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
.navItem {
|
.navItem {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 1rem;
|
margin-right: 1rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,25 +1,33 @@
|
|||||||
<script>
|
<script>
|
||||||
import { signIn, signOut } from '@auth/sveltekit/client';
|
import { signIn, signOut } from "@auth/sveltekit/client"
|
||||||
import { page } from '$app/stores';
|
import { page } from "$app/stores"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>SvelteKit + NextAuth.js Example</h1>
|
<h1>SvelteKit Auth Example</h1>
|
||||||
<p>
|
<p>
|
||||||
This is an example site to demonstrate how to use <a href="https://kit.svelte.dev/">SvelteKit</a>
|
This is an example site to demonstrate how to use <a
|
||||||
with <a href="https://next-auth.js.org">NextAuth.js</a> for authentication.
|
href="https://kit.svelte.dev/">SvelteKit</a
|
||||||
|
>
|
||||||
|
with <a href="https://sveltekit.authjs.dev">SvelteKit Auth</a> for
|
||||||
|
authentication.
|
||||||
|
|
||||||
{#if Object.keys($page.data.session || {}).length}
|
{#if $page.data.session}
|
||||||
{#if $page.data.session.user.image}
|
{#if $page.data.session.user?.image}
|
||||||
<span style="background-image: url('{$page.data.session.user.image}')" class="avatar" />
|
<span
|
||||||
{/if}
|
style="background-image: url('{$page.data.session.user.image}')"
|
||||||
<span class="signedInText">
|
class="avatar"
|
||||||
<small>Signed in as</small><br />
|
/>
|
||||||
<strong>{$page.data.session.user.email || $page.data.session.user.name}</strong>
|
{/if}
|
||||||
</span>
|
<span class="signedInText">
|
||||||
<button on:click={() => signOut()} class="button">Sign out</button>
|
<small>Signed in as</small><br />
|
||||||
{:else}
|
<strong
|
||||||
<span class="notSignedInText">You are not signed in</span>
|
>{$page.data.session.user?.email ??
|
||||||
<button on:click={() => signIn('github')}>Sign In with GitHub</button>
|
$page.data.session.user?.name}</strong
|
||||||
<button on:click={() => signIn('credentials', { redirect: false })}>Sign In credentials</button>
|
>
|
||||||
{/if}
|
</span>
|
||||||
|
<button on:click={() => signOut()} class="button">Sign out</button>
|
||||||
|
{:else}
|
||||||
|
<span class="notSignedInText">You are not signed in</span>
|
||||||
|
<button on:click={() => signIn("github")}>Sign In with GitHub</button>
|
||||||
|
{/if}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -7,4 +7,4 @@
|
|||||||
This is a protected content. You can access this content because you are
|
This is a protected content. You can access this content because you are
|
||||||
signed in.
|
signed in.
|
||||||
</p>
|
</p>
|
||||||
<p>Session expiry: {$page.data.session.expires}</p>
|
<p>Session expiry: {$page.data.session?.expires}</p>
|
||||||
|
|||||||
@@ -14,4 +14,4 @@
|
|||||||
//
|
//
|
||||||
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||||
// from the referenced tsconfig.json - TypeScript does not merge them in
|
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { sveltekit } from '@sveltejs/kit/vite';
|
import { sveltekit } from "@sveltejs/kit/vite"
|
||||||
|
|
||||||
/** @type {import('vite').UserConfig} */
|
/** @type {import('vite').UserConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
plugins: [sveltekit()]
|
plugins: [sveltekit()],
|
||||||
};
|
}
|
||||||
|
|
||||||
export default config;
|
export default config
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"repository": "https://github.com/nextauthjs/next-auth.git",
|
"repository": "https://github.com/nextauthjs/next-auth.git",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:app": "turbo run build --filter=next-auth-app",
|
"build:app": "turbo run build --filter=next-auth-app",
|
||||||
"build": "turbo run build --filter=next-auth --filter=@next-auth/* --no-deps",
|
"build": "turbo run build --filter=next-auth --filter=@next-auth/* --filter=@auth/* --no-deps",
|
||||||
"lint": "turbo run lint --filter=!next-auth-docs --parallel",
|
"lint": "turbo run lint --filter=!next-auth-docs --parallel",
|
||||||
"test": "turbo run test --concurrency=1 --filter=!@next-auth/pouchdb-adapter --filter=!@next-auth/upstash-redis-adapter --filter=!next-auth-* --filter=[HEAD^1]",
|
"test": "turbo run test --concurrency=1 --filter=!@next-auth/pouchdb-adapter --filter=!@next-auth/upstash-redis-adapter --filter=!next-auth-* --filter=[HEAD^1]",
|
||||||
"clean": "turbo run clean --no-cache",
|
"clean": "turbo run clean --no-cache",
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-promise": "^6.0.0",
|
"eslint-plugin-promise": "^6.0.0",
|
||||||
"husky": "^7.0.4",
|
"husky": "^7.0.4",
|
||||||
"prettier": "2.7.1",
|
"prettier": "2.8.1",
|
||||||
"pretty-quick": "^3.1.2",
|
"pretty-quick": "^3.1.2",
|
||||||
"semver": "7.3.5",
|
"semver": "7.3.5",
|
||||||
"stream-to-array": "2.3.0",
|
"stream-to-array": "2.3.0",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@auth/core",
|
"name": "@auth/core",
|
||||||
"version": "0.1.1",
|
"version": "0.1.3",
|
||||||
"description": "Authentication for the web.",
|
"description": "Authentication for the web.",
|
||||||
"homepage": "https://next-auth.js.org",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth.git",
|
"repository": "https://github.com/nextauthjs/next-auth.git",
|
||||||
"author": "Balázs Orbán <info@balazsorban.com>",
|
"author": "Balázs Orbán <info@balazsorban.com>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"@panva/hkdf": "1.0.2",
|
"@panva/hkdf": "1.0.2",
|
||||||
"cookie": "0.5.0",
|
"cookie": "0.5.0",
|
||||||
"jose": "4.11.1",
|
"jose": "4.11.1",
|
||||||
"oauth4webapi": "2.0.4",
|
"oauth4webapi": "2.0.5",
|
||||||
"preact": "10.11.3",
|
"preact": "10.11.3",
|
||||||
"preact-render-to-string": "5.2.3"
|
"preact-render-to-string": "5.2.3"
|
||||||
},
|
},
|
||||||
@@ -72,4 +72,4 @@
|
|||||||
"postcss": "8.4.19",
|
"postcss": "8.4.19",
|
||||||
"postcss-nested": "6.0.0"
|
"postcss-nested": "6.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Account, Awaitable, User } from "."
|
import type { Account, Awaitable, User } from "./index.js"
|
||||||
|
|
||||||
export interface AdapterUser extends User {
|
export interface AdapterUser extends User {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import { init } from "./lib/init"
|
import { init } from "./lib/init.js"
|
||||||
import { assertConfig } from "./lib/assert"
|
import { assertConfig } from "./lib/assert.js"
|
||||||
import { SessionStore } from "./lib/cookie"
|
import { SessionStore } from "./lib/cookie.js"
|
||||||
import { toInternalRequest, toResponse } from "./lib/web"
|
import { toInternalRequest, toResponse } from "./lib/web.js"
|
||||||
import renderPage from "./lib/pages"
|
import renderPage from "./lib/pages/index.js"
|
||||||
import * as routes from "./lib/routes"
|
import * as routes from "./lib/routes/index.js"
|
||||||
import logger, { setLogger } from "./lib/utils/logger"
|
import logger, { setLogger } from "./lib/utils/logger.js"
|
||||||
|
|
||||||
import type { ErrorType } from "./lib/pages/error"
|
import type { ErrorType } from "./lib/pages/error.js"
|
||||||
import type {
|
import type {
|
||||||
AuthOptions,
|
AuthOptions,
|
||||||
RequestInternal,
|
RequestInternal,
|
||||||
ResponseInternal,
|
ResponseInternal,
|
||||||
} from "./lib/types"
|
} from "./lib/types.js"
|
||||||
import { UntrustedHost } from "./lib/errors"
|
import { UntrustedHost } from "./lib/errors.js"
|
||||||
|
|
||||||
export * from "./lib/types"
|
export * from "./lib/types.js"
|
||||||
|
|
||||||
const configErrorMessage =
|
const configErrorMessage =
|
||||||
"There is a problem with the server configuration. Check the server logs for more information."
|
"There is a problem with the server configuration. Check the server logs for more information."
|
||||||
@@ -35,7 +35,7 @@ async function AuthHandlerInternal<
|
|||||||
assertionResult.forEach(logger.warn)
|
assertionResult.forEach(logger.warn)
|
||||||
} else if (assertionResult instanceof Error) {
|
} else if (assertionResult instanceof Error) {
|
||||||
// Bail out early if there's an error in the user config
|
// Bail out early if there's an error in the user config
|
||||||
logger.error(assertionResult.code, assertionResult)
|
logger.error((assertionResult as any).code, assertionResult)
|
||||||
|
|
||||||
const htmlPages = ["signin", "signout", "error", "verify-request"]
|
const htmlPages = ["signin", "signout", "error", "verify-request"]
|
||||||
if (!htmlPages.includes(req.action) || req.method !== "GET") {
|
if (!htmlPages.includes(req.action) || req.method !== "GET") {
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
import { EncryptJWT, jwtDecrypt } from "jose"
|
import { EncryptJWT, jwtDecrypt } from "jose"
|
||||||
import hkdf from "@panva/hkdf"
|
import { hkdf } from "@panva/hkdf"
|
||||||
import { SessionStore } from "../lib/cookie"
|
import { SessionStore } from "../lib/cookie.js"
|
||||||
import type { JWT, JWTDecodeParams, JWTEncodeParams, JWTOptions } from "./types"
|
import type {
|
||||||
import type { LoggerInstance } from ".."
|
JWT,
|
||||||
|
JWTDecodeParams,
|
||||||
|
JWTEncodeParams,
|
||||||
|
JWTOptions,
|
||||||
|
} from "./types.js"
|
||||||
|
import type { LoggerInstance } from "../index.js"
|
||||||
|
|
||||||
export * from "./types"
|
export * from "./types.js"
|
||||||
|
|
||||||
const DEFAULT_MAX_AGE = 30 * 24 * 60 * 60 // 30 days
|
const DEFAULT_MAX_AGE = 30 * 24 * 60 * 60 // 30 days
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Awaitable } from ".."
|
import type { Awaitable } from "../index.js"
|
||||||
|
|
||||||
export interface DefaultJWT extends Record<string, unknown> {
|
export interface DefaultJWT extends Record<string, unknown> {
|
||||||
name?: string | null
|
name?: string | null
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import {
|
|||||||
MissingAuthorize,
|
MissingAuthorize,
|
||||||
MissingSecret,
|
MissingSecret,
|
||||||
UnsupportedStrategy,
|
UnsupportedStrategy,
|
||||||
} from "./errors"
|
} from "./errors.js"
|
||||||
import { defaultCookies } from "./cookie"
|
import { defaultCookies } from "./cookie.js"
|
||||||
|
|
||||||
import type { AuthOptions, RequestInternal } from ".."
|
import type { AuthOptions, RequestInternal } from "../index.js"
|
||||||
import type { WarningCode } from "./utils/logger"
|
import type { WarningCode } from "./utils/logger.js"
|
||||||
|
|
||||||
type ConfigError =
|
type ConfigError =
|
||||||
| MissingAdapter
|
| MissingAdapter
|
||||||
@@ -56,7 +56,7 @@ export function assertConfig(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!options.secret) {
|
if (!options.secret) {
|
||||||
return new MissingSecret("Please define a `secret` in production.")
|
return new MissingSecret("Please define a `secret`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// req.query isn't defined when asserting `unstable_getServerSession` for example
|
// req.query isn't defined when asserting `unstable_getServerSession` for example
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { AccountNotLinkedError } from "./errors"
|
import { AccountNotLinkedError } from "./errors.js"
|
||||||
import { fromDate } from "./utils/date"
|
import { fromDate } from "./utils/date.js"
|
||||||
|
|
||||||
import type { Account, InternalOptions, User } from ".."
|
import type { Account, InternalOptions, User } from "../index.js"
|
||||||
import type { AdapterSession, AdapterUser } from "../adapters"
|
import type { AdapterSession, AdapterUser } from "../adapters.js"
|
||||||
import type { JWT } from "../jwt"
|
import type { JWT } from "../jwt/index.js"
|
||||||
import type { OAuthConfig } from "../providers"
|
import type { OAuthConfig } from "../providers/index.js"
|
||||||
import type { SessionToken } from "./cookie"
|
import type { SessionToken } from "./cookie.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function handles the complex flow of signing users in, and either creating,
|
* This function handles the complex flow of signing users in, and either creating,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { InternalOptions } from ".."
|
import type { InternalOptions } from "../index.js"
|
||||||
|
|
||||||
interface CreateCallbackUrlParams {
|
interface CreateCallbackUrlParams {
|
||||||
options: InternalOptions
|
options: InternalOptions
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type {
|
|||||||
CookiesOptions,
|
CookiesOptions,
|
||||||
LoggerInstance,
|
LoggerInstance,
|
||||||
SessionStrategy,
|
SessionStrategy,
|
||||||
} from ".."
|
} from "../index.js"
|
||||||
|
|
||||||
// Uncomment to recalculate the estimated size
|
// Uncomment to recalculate the estimated size
|
||||||
// of an empty session cookie
|
// of an empty session cookie
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createHash, randomString } from "./web"
|
import { createHash, randomString } from "./web.js"
|
||||||
import type { InternalOptions } from "./types"
|
import type { InternalOptions } from "./types.js"
|
||||||
|
|
||||||
interface CreateCSRFTokenParams {
|
interface CreateCSRFTokenParams {
|
||||||
options: InternalOptions
|
options: InternalOptions
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { CallbacksOptions } from ".."
|
import type { CallbacksOptions } from "../index.js"
|
||||||
|
|
||||||
export const defaultCallbacks: CallbacksOptions = {
|
export const defaultCallbacks: CallbacksOptions = {
|
||||||
signIn() {
|
signIn() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { AdapterUser } from "../../adapters"
|
import type { AdapterUser } from "../../adapters.js"
|
||||||
import type { InternalOptions } from "../.."
|
import type { InternalOptions } from "../../index.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query the database for a user by email address.
|
* Query the database for a user by email address.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { randomString, createHash } from "../web"
|
import { randomString, createHash } from "../web.js"
|
||||||
import type { InternalOptions } from "../.."
|
import type { InternalOptions } from "../../index.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts an e-mail login flow, by generating a token,
|
* Starts an e-mail login flow, by generating a token,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { EventCallbacks, LoggerInstance } from "./types"
|
import type { EventCallbacks, LoggerInstance } from "./types.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as the default `Error`, but it is JSON serializable.
|
* Same as the default `Error`, but it is JSON serializable.
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { adapterErrorHandler, eventsErrorHandler } from "./errors"
|
import { adapterErrorHandler, eventsErrorHandler } from "./errors.js"
|
||||||
import * as jwt from "../jwt"
|
import * as jwt from "../jwt/index.js"
|
||||||
import { createCallbackUrl } from "./callback-url"
|
import { createCallbackUrl } from "./callback-url.js"
|
||||||
import * as cookie from "./cookie"
|
import * as cookie from "./cookie.js"
|
||||||
import { createCSRFToken } from "./csrf-token"
|
import { createCSRFToken } from "./csrf-token.js"
|
||||||
import { defaultCallbacks } from "./default-callbacks"
|
import { defaultCallbacks } from "./default-callbacks.js"
|
||||||
import parseProviders from "./providers"
|
import parseProviders from "./providers.js"
|
||||||
import logger from "./utils/logger"
|
import logger from "./utils/logger.js"
|
||||||
import parseUrl from "./utils/parse-url"
|
import parseUrl from "./utils/parse-url.js"
|
||||||
|
|
||||||
import type { AuthOptions, InternalOptions, RequestInternal } from ".."
|
import type { AuthOptions, InternalOptions, RequestInternal } from "../index.js"
|
||||||
|
|
||||||
interface InitParams {
|
interface InitParams {
|
||||||
url: URL
|
url: URL
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import type {
|
|||||||
InternalOptions,
|
InternalOptions,
|
||||||
RequestInternal,
|
RequestInternal,
|
||||||
ResponseInternal,
|
ResponseInternal,
|
||||||
} from "../.."
|
} from "../../index.js"
|
||||||
import type { Cookie } from "../cookie"
|
import type { Cookie } from "../cookie.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an authorization/request token URL.
|
* Generates an authorization/request token URL.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { OAuthCallbackError } from "../errors"
|
import { OAuthCallbackError } from "../errors.js"
|
||||||
import { useNonce } from "./nonce-handler"
|
import { useNonce } from "./nonce-handler.js"
|
||||||
import { usePKCECodeVerifier } from "./pkce-handler"
|
import { usePKCECodeVerifier } from "./pkce-handler.js"
|
||||||
import { useState } from "./state-handler"
|
import { useState } from "./state-handler.js"
|
||||||
import * as o from "oauth4webapi"
|
import * as o from "oauth4webapi"
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
@@ -10,9 +10,9 @@ import type {
|
|||||||
Profile,
|
Profile,
|
||||||
RequestInternal,
|
RequestInternal,
|
||||||
TokenSet,
|
TokenSet,
|
||||||
} from "../.."
|
} from "../../index.js"
|
||||||
import type { OAuthConfigInternal } from "../../providers"
|
import type { OAuthConfigInternal } from "../../providers/index.js"
|
||||||
import type { Cookie } from "../cookie"
|
import type { Cookie } from "../cookie.js"
|
||||||
|
|
||||||
export async function handleOAuthCallback(params: {
|
export async function handleOAuthCallback(params: {
|
||||||
options: InternalOptions<"oauth">
|
options: InternalOptions<"oauth">
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as o from "oauth4webapi"
|
import * as o from "oauth4webapi"
|
||||||
import * as jwt from "../../jwt"
|
import * as jwt from "../../jwt/index.js"
|
||||||
|
|
||||||
import type { InternalOptions } from "../.."
|
import type { InternalOptions } from "../../index.js"
|
||||||
import type { Cookie } from "../cookie"
|
import type { Cookie } from "../cookie.js"
|
||||||
|
|
||||||
const NONCE_MAX_AGE = 60 * 15 // 15 minutes in seconds
|
const NONCE_MAX_AGE = 60 * 15 // 15 minutes in seconds
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as o from "oauth4webapi"
|
import * as o from "oauth4webapi"
|
||||||
import * as jwt from "../../jwt"
|
import * as jwt from "../../jwt/index.js"
|
||||||
|
|
||||||
import type { InternalOptions } from "../.."
|
import type { InternalOptions } from "../../index.js"
|
||||||
import type { Cookie } from "../cookie"
|
import type { Cookie } from "../cookie.js"
|
||||||
|
|
||||||
const PKCE_CODE_CHALLENGE_METHOD = "S256"
|
const PKCE_CODE_CHALLENGE_METHOD = "S256"
|
||||||
const PKCE_MAX_AGE = 60 * 15 // 15 minutes in seconds
|
const PKCE_MAX_AGE = 60 * 15 // 15 minutes in seconds
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { InternalOptions } from "../.."
|
import type { InternalOptions } from "../../index.js"
|
||||||
import type { Cookie } from "../cookie"
|
import type { Cookie } from "../cookie.js"
|
||||||
import * as o from "oauth4webapi"
|
import * as o from "oauth4webapi"
|
||||||
|
|
||||||
const STATE_MAX_AGE = 60 * 15 // 15 minutes in seconds
|
const STATE_MAX_AGE = 60 * 15 // 15 minutes in seconds
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Theme } from "../.."
|
import type { Theme } from "../../index.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following errors are passed as error query parameters to the default or overridden error page.
|
* The following errors are passed as error query parameters to the default or overridden error page.
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
import renderToString from "preact-render-to-string"
|
import { renderToString } from "preact-render-to-string"
|
||||||
import css from "../styles"
|
import css from "../styles/index.js"
|
||||||
import ErrorPage from "./error"
|
import ErrorPage from "./error.js"
|
||||||
import SigninPage from "./signin"
|
import SigninPage from "./signin.js"
|
||||||
import SignoutPage from "./signout"
|
import SignoutPage from "./signout.js"
|
||||||
import VerifyRequestPage from "./verify-request"
|
import VerifyRequestPage from "./verify-request.js"
|
||||||
|
|
||||||
import type { InternalOptions, RequestInternal, ResponseInternal } from "../.."
|
import type {
|
||||||
import type { Cookie } from "../cookie"
|
InternalOptions,
|
||||||
import type { ErrorType } from "./error"
|
RequestInternal,
|
||||||
|
ResponseInternal,
|
||||||
|
} from "../../index.js"
|
||||||
|
import type { Cookie } from "../cookie.js"
|
||||||
|
import type { ErrorType } from "./error.js"
|
||||||
|
|
||||||
type RenderPageParams = {
|
type RenderPageParams = {
|
||||||
query?: RequestInternal["query"]
|
query?: RequestInternal["query"]
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import type { InternalProvider, Theme } from "../.."
|
import type { InternalProvider, Theme } from "../../index.js"
|
||||||
import type { CSSProperties } from "react"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following errors are passed as error query parameters to the default or overridden sign-in page.
|
* The following errors are passed as error query parameters to the default or overridden sign-in page.
|
||||||
@@ -92,15 +91,12 @@ export default function SigninPage(props: SignInServerPageParams) {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="button"
|
className="button"
|
||||||
style={
|
style={{
|
||||||
// eslint-disable-next-line
|
"--provider-bg": provider.style?.bg ?? "",
|
||||||
{
|
"--provider-dark-bg": provider.style?.bgDark ?? "",
|
||||||
"--provider-bg": provider.style?.bg ?? "",
|
"--provider-color": provider.style?.text ?? "",
|
||||||
"--provider-dark-bg": provider.style?.bgDark ?? "",
|
"--provider-dark-color": provider.style?.textDark ?? "",
|
||||||
"--provider-color": provider.style?.text ?? "",
|
}}
|
||||||
"--provider-dark-color": provider.style?.textDark ?? "",
|
|
||||||
} as CSSProperties
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{provider.style?.logo && (
|
{provider.style?.logo && (
|
||||||
<img
|
<img
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Theme } from "../.."
|
import type { Theme } from "../../index.js"
|
||||||
|
|
||||||
export interface SignoutProps {
|
export interface SignoutProps {
|
||||||
url: URL
|
url: URL
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Theme } from "../.."
|
import type { Theme } from "../../index.js"
|
||||||
|
|
||||||
interface VerifyRequestPageProps {
|
interface VerifyRequestPageProps {
|
||||||
url: URL
|
url: URL
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { merge } from "./utils/merge"
|
import { merge } from "./utils/merge.js"
|
||||||
|
|
||||||
import type { InternalProvider } from ".."
|
import type { InternalProvider } from "../index.js"
|
||||||
import type {
|
import type {
|
||||||
OAuthConfig,
|
OAuthConfig,
|
||||||
OAuthConfigInternal,
|
OAuthConfigInternal,
|
||||||
OAuthEndpointType,
|
OAuthEndpointType,
|
||||||
OAuthUserConfig,
|
OAuthUserConfig,
|
||||||
Provider,
|
Provider,
|
||||||
} from "../providers"
|
} from "../providers/index.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds `signinUrl` and `callbackUrl` to each provider
|
* Adds `signinUrl` and `callbackUrl` to each provider
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import callbackHandler from "../callback-handler"
|
import callbackHandler from "../callback-handler.js"
|
||||||
import getAdapterUserFromEmail from "../email/getUserFromEmail"
|
import getAdapterUserFromEmail from "../email/getUserFromEmail.js"
|
||||||
import { handleOAuthCallback } from "../oauth/callback"
|
import { handleOAuthCallback } from "../oauth/callback.js"
|
||||||
import { createHash } from "../web"
|
import { createHash } from "../web.js"
|
||||||
|
|
||||||
import type { RequestInternal, ResponseInternal, User } from "../.."
|
import type { RequestInternal, ResponseInternal, User } from "../../index.js"
|
||||||
import type { AdapterSession } from "../../adapters"
|
import type { AdapterSession } from "../../adapters.js"
|
||||||
import type { Cookie, SessionStore } from "../cookie"
|
import type { Cookie, SessionStore } from "../cookie.js"
|
||||||
import type { InternalOptions } from "../types"
|
import type { InternalOptions } from "../types.js"
|
||||||
|
|
||||||
/** Handle callbacks from login services */
|
/** Handle callbacks from login services */
|
||||||
export async function callback(params: {
|
export async function callback(params: {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export { callback } from "./callback"
|
export { callback } from "./callback.js"
|
||||||
export { providers } from "./providers"
|
export { providers } from "./providers.js"
|
||||||
export { session } from "./session"
|
export { session } from "./session.js"
|
||||||
export { signin } from "./signin"
|
export { signin } from "./signin.js"
|
||||||
export { signout } from "./signout"
|
export { signout } from "./signout.js"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { InternalProvider, ResponseInternal } from "../.."
|
import type { InternalProvider, ResponseInternal } from "../../index.js"
|
||||||
|
|
||||||
export interface PublicProvider {
|
export interface PublicProvider {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { fromDate } from "../utils/date"
|
import { fromDate } from "../utils/date.js"
|
||||||
|
|
||||||
import type { InternalOptions, ResponseInternal, Session } from "../.."
|
import type { InternalOptions, ResponseInternal, Session } from "../../index.js"
|
||||||
import type { Adapter } from "../../adapters"
|
import type { Adapter } from "../../adapters.js"
|
||||||
import type { SessionStore } from "../cookie"
|
import type { SessionStore } from "../cookie.js"
|
||||||
|
|
||||||
interface SessionParams {
|
interface SessionParams {
|
||||||
options: InternalOptions
|
options: InternalOptions
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import getAdapterUserFromEmail from "../email/getUserFromEmail"
|
import getAdapterUserFromEmail from "../email/getUserFromEmail.js"
|
||||||
import emailSignin from "../email/signin"
|
import emailSignin from "../email/signin.js"
|
||||||
import { getAuthorizationUrl } from "../oauth/authorization-url"
|
import { getAuthorizationUrl } from "../oauth/authorization-url.js"
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
Account,
|
Account,
|
||||||
InternalOptions,
|
InternalOptions,
|
||||||
RequestInternal,
|
RequestInternal,
|
||||||
ResponseInternal,
|
ResponseInternal,
|
||||||
} from "../.."
|
} from "../../index.js"
|
||||||
|
|
||||||
/** Handle requests to /api/auth/signin */
|
/** Handle requests to /api/auth/signin */
|
||||||
export async function signin(params: {
|
export async function signin(params: {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { InternalOptions, ResponseInternal } from "../.."
|
import type { InternalOptions, ResponseInternal } from "../../index.js"
|
||||||
import type { Adapter } from "../../adapters"
|
import type { Adapter } from "../../adapters.js"
|
||||||
import type { SessionStore } from "../cookie"
|
import type { SessionStore } from "../cookie.js"
|
||||||
|
|
||||||
/** Handle requests to /api/auth/signout */
|
/** Handle requests to /api/auth/signout */
|
||||||
export async function signout(params: {
|
export async function signout(params: {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { CookieSerializeOptions } from "cookie"
|
import type { CookieSerializeOptions } from "cookie"
|
||||||
import type { Adapter, AdapterUser } from "../adapters"
|
import type { Adapter, AdapterUser } from "../adapters.js"
|
||||||
import type {
|
import type {
|
||||||
CredentialInput,
|
CredentialInput,
|
||||||
CredentialsConfig,
|
CredentialsConfig,
|
||||||
@@ -7,16 +7,15 @@ import type {
|
|||||||
OAuthConfigInternal,
|
OAuthConfigInternal,
|
||||||
Provider,
|
Provider,
|
||||||
ProviderType,
|
ProviderType,
|
||||||
} from "../providers"
|
} from "../providers/index.js"
|
||||||
import type {
|
import type {
|
||||||
OAuth2TokenEndpointResponse,
|
OAuth2TokenEndpointResponse,
|
||||||
OpenIDTokenEndpointResponse,
|
OpenIDTokenEndpointResponse,
|
||||||
} from "oauth4webapi"
|
} from "oauth4webapi"
|
||||||
import type { JWT, JWTOptions } from "../jwt"
|
import type { JWT, JWTOptions } from "../jwt/types.js"
|
||||||
import type { Cookie } from "./cookie"
|
import type { Cookie } from "./cookie.js"
|
||||||
import type { LoggerInstance } from "./utils/logger"
|
import type { LoggerInstance } from "./utils/logger.js"
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
export type Awaitable<T> = T | PromiseLike<T>
|
export type Awaitable<T> = T | PromiseLike<T>
|
||||||
|
|
||||||
export type { LoggerInstance }
|
export type { LoggerInstance }
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { UnknownError } from "../errors"
|
import { UnknownError } from "../errors.js"
|
||||||
|
|
||||||
/** Makes sure that error is always serializable */
|
/** Makes sure that error is always serializable */
|
||||||
function formatError(o: unknown): unknown {
|
function formatError(o: unknown): unknown {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { parse as parseCookie, serialize } from "cookie"
|
import { parse as parseCookie, serialize } from "cookie"
|
||||||
import type { RequestInternal, ResponseInternal } from ".."
|
import type { RequestInternal, ResponseInternal } from "../index.js"
|
||||||
import { UnknownAction } from "./errors"
|
import { UnknownAction } from "./errors.js"
|
||||||
import type { AuthAction } from "./types"
|
import type { AuthAction } from "./types.js"
|
||||||
|
|
||||||
async function getBody(req: Request): Promise<Record<string, any> | undefined> {
|
async function getBody(req: Request): Promise<Record<string, any> | undefined> {
|
||||||
if (!("body" in req) || !req.body || req.method !== "POST") return
|
if (!("body" in req) || !req.body || req.method !== "POST") return
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface UserData {
|
export interface UserData {
|
||||||
id: number
|
id: number
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { OAuthConfig, OAuthUserConfig } from "."
|
import { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See more at:
|
* See more at:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
interface AtlassianProfile extends Record<string, any> {
|
interface AtlassianProfile extends Record<string, any> {
|
||||||
account_id: string
|
account_id: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface Auth0Profile extends Record<string, any> {
|
export interface Auth0Profile extends Record<string, any> {
|
||||||
sub: string
|
sub: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface AuthentikProfile extends Record<string, any> {
|
export interface AuthentikProfile extends Record<string, any> {
|
||||||
iss: string
|
iss: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface AzureB2CProfile extends Record<string, any> {
|
export interface AzureB2CProfile extends Record<string, any> {
|
||||||
exp: number
|
exp: number
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface AzureADProfile extends Record<string, any> {
|
export interface AzureADProfile extends Record<string, any> {
|
||||||
sub: string
|
sub: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface BattleNetProfile extends Record<string, any> {
|
export interface BattleNetProfile extends Record<string, any> {
|
||||||
sub: string
|
sub: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface BoxyHQSAMLProfile extends Record<string, any> {
|
export interface BoxyHQSAMLProfile extends Record<string, any> {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface CognitoProfile extends Record<string, any> {
|
export interface CognitoProfile extends Record<string, any> {
|
||||||
sub: string
|
sub: string
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { CommonProviderOptions } from "."
|
import type { CommonProviderOptions } from "./index.js"
|
||||||
import type { Awaitable, RequestInternal, User } from ".."
|
import type { Awaitable, RequestInternal, User } from "../index.js"
|
||||||
|
|
||||||
export interface CredentialInput {
|
export interface CredentialInput {
|
||||||
label?: string
|
label?: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface DiscordProfile extends Record<string, any> {
|
export interface DiscordProfile extends Record<string, any> {
|
||||||
accent_color: number
|
accent_color: number
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { createTransport } from "nodemailer"
|
import { createTransport } from "nodemailer"
|
||||||
|
|
||||||
import type { CommonProviderOptions } from "."
|
import type { CommonProviderOptions } from "./index.js"
|
||||||
import type { Options as SMTPTransportOptions } from "nodemailer/lib/smtp-transport"
|
import type { Options as SMTPTransportOptions } from "nodemailer/lib/smtp-transport"
|
||||||
import type { Awaitable, Theme } from ".."
|
import type { Awaitable, Theme } from "../index.js"
|
||||||
|
|
||||||
export interface SendVerificationRequestParams {
|
export interface SendVerificationRequestParams {
|
||||||
identifier: string
|
identifier: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface EVEOnlineProfile extends Record<string, any> {
|
export interface EVEOnlineProfile extends Record<string, any> {
|
||||||
CharacterID: number
|
CharacterID: number
|
||||||
@@ -17,7 +17,8 @@ export default function EVEOnline<P extends EVEOnlineProfile>(
|
|||||||
id: "eveonline",
|
id: "eveonline",
|
||||||
name: "EVE Online",
|
name: "EVE Online",
|
||||||
type: "oauth",
|
type: "oauth",
|
||||||
authorization: "https://login.eveonline.com/v2/oauth/authorize?scope=publicData",
|
authorization:
|
||||||
|
"https://login.eveonline.com/v2/oauth/authorize?scope=publicData",
|
||||||
token: "https://login.eveonline.com/v2/oauth/token",
|
token: "https://login.eveonline.com/v2/oauth/token",
|
||||||
userinfo: "https://login.eveonline.com/oauth/verify",
|
userinfo: "https://login.eveonline.com/oauth/verify",
|
||||||
profile(profile) {
|
profile(profile) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
interface FacebookPictureData {
|
interface FacebookPictureData {
|
||||||
url: string
|
url: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
/** @see https://docs.github.com/en/rest/users/users#get-the-authenticated-user */
|
/** @see https://docs.github.com/en/rest/users/users#get-the-authenticated-user */
|
||||||
export interface GithubProfile extends Record<string, any> {
|
export interface GithubProfile extends Record<string, any> {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface GitLabProfile extends Record<string, any> {
|
export interface GitLabProfile extends Record<string, any> {
|
||||||
id: number
|
id: number
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface GoogleProfile extends Record<string, any> {
|
export interface GoogleProfile extends Record<string, any> {
|
||||||
aud: string
|
aud: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
interface HubSpotProfile extends Record<string, any> {
|
interface HubSpotProfile extends Record<string, any> {
|
||||||
// https://legacydocs.hubspot.com/docs/methods/oauth2/get-access-token-information
|
// https://legacydocs.hubspot.com/docs/methods/oauth2/get-access-token-information
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import type { OAuthConfig, OAuthProvider, OAuthProviderType } from "./oauth"
|
import type { OAuthConfig, OAuthProvider, OAuthProviderType } from "./oauth.js"
|
||||||
import type { EmailConfig, EmailProvider, EmailProviderType } from "./email"
|
import type { EmailConfig, EmailProvider, EmailProviderType } from "./email.js"
|
||||||
import type {
|
import type {
|
||||||
CredentialsConfig,
|
CredentialsConfig,
|
||||||
CredentialsProvider,
|
CredentialsProvider,
|
||||||
CredentialsProviderType,
|
CredentialsProviderType,
|
||||||
} from "./credentials"
|
} from "./credentials.js"
|
||||||
|
|
||||||
export * from "./credentials"
|
export * from "./credentials.js"
|
||||||
export * from "./email"
|
export * from "./email.js"
|
||||||
export * from "./oauth"
|
export * from "./oauth.js"
|
||||||
|
|
||||||
export type ProviderType = "oidc" | "oauth" | "email" | "credentials"
|
export type ProviderType = "oidc" | "oauth" | "email" | "credentials"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export type DateTime = string
|
export type DateTime = string
|
||||||
export type Gender = "female" | "male"
|
export type Gender = "female" | "male"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface KeycloakProfile extends Record<string, any> {
|
export interface KeycloakProfile extends Record<string, any> {
|
||||||
exp: number
|
exp: number
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface LineProfile extends Record<string, any> {
|
export interface LineProfile extends Record<string, any> {
|
||||||
iss: string
|
iss: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
interface Identifier {
|
interface Identifier {
|
||||||
identifier: string
|
identifier: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
/** https://developers.naver.com/docs/login/profile/profile.md */
|
/** https://developers.naver.com/docs/login/profile/profile.md */
|
||||||
export interface NaverProfile extends Record<string, any> {
|
export interface NaverProfile extends Record<string, any> {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { CommonProviderOptions } from "../providers"
|
import type { CommonProviderOptions } from "../providers/index.js"
|
||||||
import type { Profile, TokenSet, User, Awaitable } from ".."
|
import type { Profile, TokenSet, User, Awaitable } from "../index.js"
|
||||||
import type { Client } from "oauth4webapi"
|
import type { Client } from "oauth4webapi"
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
@@ -9,7 +9,7 @@ type IssuerMetadata = any
|
|||||||
type OAuthCallbackChecks = any
|
type OAuthCallbackChecks = any
|
||||||
type OpenIDCallbackChecks = any
|
type OpenIDCallbackChecks = any
|
||||||
|
|
||||||
export type { OAuthProviderType } from "./oauth-types"
|
export type { OAuthProviderType } from "./oauth-types.js"
|
||||||
|
|
||||||
type ChecksType = "pkce" | "state" | "none" | "nonce"
|
type ChecksType = "pkce" | "state" | "none" | "nonce"
|
||||||
|
|
||||||
@@ -96,6 +96,17 @@ export interface OAuthProviderButtonStyles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface OAuth2Config<P> extends CommonProviderOptions, PartialIssuer {
|
export interface OAuth2Config<P> extends CommonProviderOptions, PartialIssuer {
|
||||||
|
/**
|
||||||
|
* Identifies the provider when you want to sign in to
|
||||||
|
* a specific provider.
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* signIn('github') // "github" is the provider ID
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
id: string
|
||||||
|
/** The name of the provider. shown on the default sign in page. */
|
||||||
|
name: string
|
||||||
/**
|
/**
|
||||||
* OpenID Connect (OIDC) compliant providers can configure
|
* OpenID Connect (OIDC) compliant providers can configure
|
||||||
* this instead of `authorize`/`token`/`userinfo` options
|
* this instead of `authorize`/`token`/`userinfo` options
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface OktaProfile extends Record<string, any> {
|
export interface OktaProfile extends Record<string, any> {
|
||||||
iss: string
|
iss: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface OsuUserCompact {
|
export interface OsuUserCompact {
|
||||||
avatar_url: string
|
avatar_url: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface PatreonProfile extends Record<string, any> {
|
export interface PatreonProfile extends Record<string, any> {
|
||||||
sub: string
|
sub: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { OAuthConfig, OAuthUserConfig } from "."
|
import { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface PinterestProfile extends Record<string, any> {
|
export interface PinterestProfile extends Record<string, any> {
|
||||||
account_type: "BUSINESS" | "PINNER"
|
account_type: "BUSINESS" | "PINNER"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface PipedriveProfile extends Record<string, any> {
|
export interface PipedriveProfile extends Record<string, any> {
|
||||||
success: boolean
|
success: boolean
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface SalesforceProfile extends Record<string, any> {
|
export interface SalesforceProfile extends Record<string, any> {
|
||||||
sub: string
|
sub: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface SlackProfile extends Record<string, any> {
|
export interface SlackProfile extends Record<string, any> {
|
||||||
ok: boolean
|
ok: boolean
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface SpotifyImage {
|
export interface SpotifyImage {
|
||||||
url: string
|
url: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface StravaProfile extends Record<string, any> {
|
export interface StravaProfile extends Record<string, any> {
|
||||||
id: string // this is really a number
|
id: string // this is really a number
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://developer.todoist.com/sync/v9/#user
|
* @see https://developer.todoist.com/sync/v9/#user
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface TraktUser extends Record<string, any> {
|
export interface TraktUser extends Record<string, any> {
|
||||||
username: string
|
username: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface TwitchProfile extends Record<string, any> {
|
export interface TwitchProfile extends Record<string, any> {
|
||||||
sub: string
|
sub: string
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// TODO: move OAuth 1.0 support or remove it?
|
// TODO: move OAuth 1.0 support or remove it?
|
||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface TwitterLegacyProfile {
|
export interface TwitterLegacyProfile {
|
||||||
id: number
|
id: number
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface UnitedEffectsProfile extends Record<string, any> {
|
export interface UnitedEffectsProfile extends Record<string, any> {
|
||||||
sub: string
|
sub: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface VkProfile {
|
export interface VkProfile {
|
||||||
// https://dev.vk.com/reference/objects/user
|
// https://dev.vk.com/reference/objects/user
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export type WikimediaGroup =
|
export type WikimediaGroup =
|
||||||
| "*"
|
| "*"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface WorkOSProfile extends Record<string, any> {
|
export interface WorkOSProfile extends Record<string, any> {
|
||||||
object: string
|
object: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OIDCConfig, OAuthUserConfig } from "."
|
import type { OIDCConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface ZitadelProfile extends Record<string, any> {
|
export interface ZitadelProfile extends Record<string, any> {
|
||||||
amr: string // Authentication Method References as defined in RFC8176
|
amr: string // Authentication Method References as defined in RFC8176
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { OAuthConfig, OAuthUserConfig } from "."
|
import type { OAuthConfig, OAuthUserConfig } from "./index.js"
|
||||||
|
|
||||||
export interface ZoomProfile extends Record<string, any> {
|
export interface ZoomProfile extends Record<string, any> {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
|
"jsxImportSource": "preact",
|
||||||
"lib": [
|
"lib": [
|
||||||
"dom",
|
"dom",
|
||||||
"dom.iterable",
|
"dom.iterable",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ module.exports = {
|
|||||||
"prettier",
|
"prettier",
|
||||||
],
|
],
|
||||||
plugins: ["svelte3", "@typescript-eslint"],
|
plugins: ["svelte3", "@typescript-eslint"],
|
||||||
ignorePatterns: ["*.cjs"],
|
ignorePatterns: ["*.cjs", "client.*", "index.*"],
|
||||||
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
|
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
|
||||||
settings: {
|
settings: {
|
||||||
"svelte3/typescript": () => require("typescript"),
|
"svelte3/typescript": () => require("typescript"),
|
||||||
|
|||||||
@@ -3,11 +3,5 @@ node_modules
|
|||||||
/build
|
/build
|
||||||
/.svelte-kit
|
/.svelte-kit
|
||||||
/package
|
/package
|
||||||
.env
|
/index.*
|
||||||
.env.*
|
/client.*
|
||||||
!.env.example
|
|
||||||
|
|
||||||
# Ignore files for PNPM, NPM and YARN
|
|
||||||
pnpm-lock.yaml
|
|
||||||
package-lock.json
|
|
||||||
yarn.lock
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# SvelteKit Auth
|
# SvelteKit Auth
|
||||||
|
|
||||||
Authentication for SvelteKit.
|
Authentication for SvelteKit.
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "@auth/sveltekit",
|
"name": "@auth/sveltekit",
|
||||||
"version": "0.1.1",
|
"version": "0.1.4",
|
||||||
|
"description": "Authentication for SvelteKit.",
|
||||||
|
"homepage": "https://sveltekit.authjs.dev",
|
||||||
|
"repository": "https://github.com/nextauthjs/next-auth.git",
|
||||||
"author": "Thang Huu Vu <hi@thvu.dev>",
|
"author": "Thang Huu Vu <hi@thvu.dev>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Thang Huu Vu <hi@thvu.dev>",
|
"Thang Huu Vu <hi@thvu.dev>",
|
||||||
@@ -12,7 +15,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "svelte-package -w",
|
"dev": "svelte-package -w",
|
||||||
"clean": "rm -rf client.* index.* package",
|
"clean": "rm -rf client.* index.* package",
|
||||||
"build": "pnpm clean && svelte-package && node ./scripts/postbuild.js && rm -rf package",
|
"build": "pnpm clean && pnpm check && svelte-package && node ./scripts/postbuild.js && rm -rf package",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||||
@@ -31,7 +34,7 @@
|
|||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"eslint-plugin-svelte3": "^4.0.0",
|
"eslint-plugin-svelte3": "^4.0.0",
|
||||||
"next-auth": "workspace:*",
|
"next-auth": "workspace:*",
|
||||||
"prettier": "^2.8.0",
|
"prettier": "2.8.1",
|
||||||
"prettier-plugin-svelte": "^2.8.1",
|
"prettier-plugin-svelte": "^2.8.1",
|
||||||
"svelte": "^3.54.0",
|
"svelte": "^3.54.0",
|
||||||
"svelte-check": "^2.9.2",
|
"svelte-check": "^2.9.2",
|
||||||
@@ -43,6 +46,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@auth/core": "workspace:*"
|
"@auth/core": "workspace:*"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"svelte": "^3.54.0",
|
||||||
|
"svelte-kit": "^1.0.0"
|
||||||
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./index.d.ts",
|
"types": "./index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
@@ -61,4 +68,4 @@
|
|||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user