mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
39 Commits
@auth/svel
...
@auth/core
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6f5c4d1cf | ||
|
|
09a075cc7e | ||
|
|
f1475955ea | ||
|
|
e6f48775fa | ||
|
|
ba87e86d47 | ||
|
|
b0dd1fac93 | ||
|
|
054288316b | ||
|
|
5e02019a3c | ||
|
|
9da0e66193 | ||
|
|
287c8f0f91 | ||
|
|
87ed5077ad | ||
|
|
2cbf815445 | ||
|
|
d63166db3a | ||
|
|
f387793d71 | ||
|
|
b0ecf4e861 | ||
|
|
5a73c6efa3 | ||
|
|
4aec142525 | ||
|
|
45f423ed5d | ||
|
|
2e52a89c52 | ||
|
|
ecde35e9c4 | ||
|
|
5a51330d55 | ||
|
|
b2db3eabee | ||
|
|
3865e44c1e | ||
|
|
9f5acc5749 | ||
|
|
0bbc8246b8 | ||
|
|
511f66b0a8 | ||
|
|
ae57199258 | ||
|
|
aad425fced | ||
|
|
8ef1010bb1 | ||
|
|
950ca3169a | ||
|
|
edbf0fc011 | ||
|
|
46bac818fe | ||
|
|
9e64eb0cdd | ||
|
|
955e379330 | ||
|
|
7be4461253 | ||
|
|
c2e06dc445 | ||
|
|
4dd70a5f6f | ||
|
|
98dbf56494 | ||
|
|
6b4644f7e7 |
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -8,7 +8,7 @@ merge of your pull request!
|
||||
> _NOTE_:
|
||||
>
|
||||
> - It's a good idea to open an issue first to discuss potential changes.
|
||||
> - Please make sure that you are _NOT_ opening a PR to fix a potential security vulnerability. Instead, please follow the [Security guidelines](../Security.md) to disclose the issue to us confidentially.
|
||||
> - Please make sure that you are _NOT_ opening a PR to fix a potential security vulnerability. Instead, please follow the [Security guidelines](https://github.com/nextauthjs/.github/blob/main/SECURITY.md) to disclose the issue to us confidentially.
|
||||
|
||||
## ☕️ Reasoning
|
||||
|
||||
@@ -28,7 +28,7 @@ Fixes: INSERT_ISSUE_LINK_HERE
|
||||
|
||||
## 📌 Resources
|
||||
|
||||
- [Security guidelines](../Security.md)
|
||||
- [Contributing guidelines](../CONTRIBUTING.md)
|
||||
- [Code of conduct](../CODE_OF_CONDUCT.md)
|
||||
- [Security guidelines](https://github.com/nextauthjs/.github/blob/main/SECURITY.md)
|
||||
- [Contributing guidelines](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md)
|
||||
- [Code of conduct](https://github.com/nextauthjs/.github/blob/main/CODE_OF_CONDUCT.md)
|
||||
- [Contributing to Open Source](https://kcd.im/pull-request)
|
||||
|
||||
98
.github/pr-labeler.yml
vendored
98
.github/pr-labeler.yml
vendored
@@ -1,74 +1,26 @@
|
||||
# https://github.com/actions/labeler#create-githublabeleryml
|
||||
|
||||
test:
|
||||
- test/**/*
|
||||
- types/tests/**/*
|
||||
|
||||
providers:
|
||||
- packages/next-auth/src/providers/**/*
|
||||
- test/integration/**/*
|
||||
|
||||
adapters:
|
||||
- packages/next-auth/src/adapters.ts
|
||||
- packages/adapter-*/**
|
||||
|
||||
dgraph:
|
||||
- packages/adapter-dgraph/**
|
||||
|
||||
dynamodb:
|
||||
- packages/adapter-dynamodb/**
|
||||
|
||||
fauna:
|
||||
- packages/adapter-fauna/**
|
||||
|
||||
firebase:
|
||||
- packages/adapter-firebase/**
|
||||
|
||||
mikro-orm:
|
||||
- packages/adapter-mikro-orm/**
|
||||
|
||||
mongodb:
|
||||
- packages/adapter-mongodb/**
|
||||
|
||||
neo4j:
|
||||
- packages/adapter-neo4j/**
|
||||
|
||||
pouchdb:
|
||||
- packages/adapter-pouchdb/**
|
||||
|
||||
prisma:
|
||||
- packages/adapter-prisma/**
|
||||
|
||||
sequelize:
|
||||
- packages/adapter-sequelize/**
|
||||
|
||||
supabase:
|
||||
- packages/adapter-supabase/**
|
||||
|
||||
typeorm-legacy:
|
||||
- packages/adapter-typeorm-legacy/**
|
||||
|
||||
upstash-redis:
|
||||
- packages/adapter-upstash-redis/**
|
||||
|
||||
xata:
|
||||
- packages/adapter-xata/**
|
||||
|
||||
core:
|
||||
- packages/next-auth/src/**/*
|
||||
|
||||
style:
|
||||
- packages/next-auth/src/css/**/*
|
||||
|
||||
client:
|
||||
- packages/next-auth/src/client/**/*
|
||||
- packages/next-auth/src/react/**/*
|
||||
|
||||
pages:
|
||||
- packages/next-auth/src/core/pages/**/*
|
||||
|
||||
TypeScript:
|
||||
- packages/next-auth/src/**/types.ts
|
||||
|
||||
documentation:
|
||||
- packages/docs/docs/**/*
|
||||
adapters: ["packages/core/src/adapters.ts", "packages/adapter-*/**/*"]
|
||||
core: ["packages/core/src/**/*"]
|
||||
dgraph: ["packages/adapter-dgraph/**/*"]
|
||||
documentation: ["packages/docs/docs/**/*"]
|
||||
dynamodb: ["packages/adapter-dynamodb/**/*"]
|
||||
examples: ["apps/examples/**/*"]
|
||||
fauna: ["packages/adapter-fauna/**/*"]
|
||||
firebase: ["packages/adapter-firebase/**/*"]
|
||||
frameworks: ["packages/frameworks-*/**/*"]
|
||||
legacy: ["packages/next-auth/**/*"]
|
||||
mikro-orm: ["packages/adapter-mikro-orm/**/*"]
|
||||
mongodb: ["packages/adapter-mongodb/**/*"]
|
||||
neo4j: ["packages/adapter-neo4j/**/*"]
|
||||
playgrounds: ["apps/playgrounds/**/*"]
|
||||
pouchdb: ["packages/adapter-pouchdb/**/*"]
|
||||
prisma: ["packages/adapter-prisma/**/*"]
|
||||
providers: ["packages/core/src/providers/**/*"]
|
||||
sequelize: ["packages/adapter-sequelize/**/*"]
|
||||
solidjs: ["packages/frameworks-solid-start/**/*"]
|
||||
supabase: ["packages/adapter-supabase/**/*"]
|
||||
svelte: ["packages/frameworks-sveltekit/**/*"]
|
||||
test: ["**test**/*"]
|
||||
typeorm-legacy: ["packages/adapter-typeorm-legacy/**/*"]
|
||||
upstash-redis: ["packages/adapter-upstash-redis/**/*"]
|
||||
xata: ["packages/adapter-xata/**/*"]
|
||||
|
||||
14
.github/sync.yml
vendored
14
.github/sync.yml
vendored
@@ -1,14 +1,24 @@
|
||||
# Note that nextauthjs/next-auth-example syncs from the v4 branch
|
||||
|
||||
nextauthjs/sveltekit-auth-example:
|
||||
- source: apps/example-sveltekit
|
||||
- source: apps/examples/sveltekit
|
||||
dest: .
|
||||
deleteOrphaned: true
|
||||
- .github/FUNDING.yml
|
||||
- LICENSE
|
||||
|
||||
# FIXME: Should re-enable, but currently fails:
|
||||
# https://github.com/nextauthjs/next-auth/actions/runs/3811709391/jobs/6484533340
|
||||
# (issue seems to be the name of the target repo)
|
||||
# nextauthjs/solid-start-auth-example:
|
||||
# - source: "apps/examples/solid-start"
|
||||
# dest: .
|
||||
# deleteOrphaned: true
|
||||
# - .github/FUNDING.yml
|
||||
# - LICENSE
|
||||
|
||||
nextauthjs/next-auth-gatsby-example:
|
||||
- source: apps/playground-gatsby
|
||||
- source: apps/playgrounds/gatsby
|
||||
dest: .
|
||||
deleteOrphaned: true
|
||||
- .github/FUNDING.yml
|
||||
|
||||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -29,9 +29,12 @@ jobs:
|
||||
run: pnpm install
|
||||
- name: Run tests
|
||||
run: pnpm test
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
UPSTASH_REDIS_URL: ${{ secrets.UPSTASH_REDIS_URL }}
|
||||
UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }}
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
# - name: Coverage
|
||||
# uses: codecov/codecov-action@v1
|
||||
# with:
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -86,6 +86,7 @@ packages/core/*.d.ts
|
||||
packages/core/*.d.ts.map
|
||||
packages/core/lib
|
||||
packages/core/providers
|
||||
packages/core/src/lib/pages/styles.ts
|
||||
docs/docs/reference/03-core
|
||||
docs/docs/reference/04-sveltekit
|
||||
|
||||
|
||||
4
apps/dev/.vscode/settings.json
vendored
4
apps/dev/.vscode/settings.json
vendored
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"typescript.tsdk": "../../node_modules/.pnpm/typescript@4.9.4/node_modules/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
||||
}
|
||||
4
apps/dev/nextjs/.vscode/settings.json
vendored
Normal file
4
apps/dev/nextjs/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"typescript.tsdk": "../../../node_modules/.pnpm/typescript@4.9.4/node_modules/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
||||
}
|
||||
@@ -3,4 +3,4 @@
|
||||
This folder contains a Next.js app using NextAuth.js for local development. See the following section on how to start:
|
||||
|
||||
[Setting up local environment
|
||||
](https://github.com/nextauthjs/next-auth/blob/main/CONTRIBUTING.md#setting-up-local-environment)
|
||||
](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md#setting-up-local-environment)
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "next-auth-app",
|
||||
"version": "1.0.0",
|
||||
"description": "NextAuth.js Developer app",
|
||||
"description": "Next.js + Auth.js Developer app",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"clean": "rm -rf .next",
|
||||
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"name": "sveltekit-auth-app",
|
||||
"version": "1.0.0",
|
||||
"description": "SvelteKit + Auth.js Developer app",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
@@ -2,9 +2,18 @@
|
||||
import { page } from "$app/stores"
|
||||
</script>
|
||||
|
||||
{#if $page.data.session}
|
||||
<h1>Protected page</h1>
|
||||
<p>
|
||||
This is a protected content. You can access this content because you are
|
||||
signed in.
|
||||
</p>
|
||||
<p>Session expiry: {$page.data.session?.expires}</p>
|
||||
{:else}
|
||||
<h1>Access Denied</h1>
|
||||
<p>
|
||||
<a href="/auth/signin">
|
||||
You must be signed in to view this page
|
||||
</a>
|
||||
</p>
|
||||
{/if}
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
5
apps/example-nextjs/next-env.d.ts
vendored
5
apps/example-nextjs/next-env.d.ts
vendored
@@ -1,5 +0,0 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
@@ -1,10 +0,0 @@
|
||||
import { redirect } from "@sveltejs/kit"
|
||||
import type { PageLoad } from "./$types"
|
||||
|
||||
export const load: PageLoad = async ({ parent }) => {
|
||||
const { session } = await parent()
|
||||
if (!session?.user) {
|
||||
throw redirect(302, "/")
|
||||
}
|
||||
return {}
|
||||
}
|
||||
3
apps/examples/solid-start/.env.example
Normal file
3
apps/examples/solid-start/.env.example
Normal file
@@ -0,0 +1,3 @@
|
||||
GITHUB_ID=
|
||||
GITHUB_SECRET=
|
||||
AUTH_SECRET=
|
||||
27
apps/examples/solid-start/.gitignore
vendored
Normal file
27
apps/examples/solid-start/.gitignore
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
dist
|
||||
.solid
|
||||
.output
|
||||
.vercel
|
||||
.netlify
|
||||
netlify
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
*.launch
|
||||
.settings/
|
||||
|
||||
# Temp
|
||||
gitignore
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
.env
|
||||
|
||||
.vercel
|
||||
37
apps/examples/solid-start/README.MD
Normal file
37
apps/examples/solid-start/README.MD
Normal file
@@ -0,0 +1,37 @@
|
||||
# Create JD App
|
||||
|
||||
This project was created using [Create JD App](https://github.com/OrJDev/create-jd-app)
|
||||
|
||||
## Deploying To Vercel
|
||||
|
||||
### Installing
|
||||
|
||||
```bash
|
||||
npm install solid-start-vercel@latest -D
|
||||
```
|
||||
|
||||
### Adding to vite config
|
||||
|
||||
```ts
|
||||
import solid from "solid-start/vite";
|
||||
import dotenv from "dotenv";
|
||||
import { defineConfig } from "vite";
|
||||
// @ts-expect-error no typing
|
||||
import vercel from "solid-start-vercel";
|
||||
|
||||
export default defineConfig(() => {
|
||||
dotenv.config();
|
||||
return {
|
||||
plugins: [solid({ ssr: true, adapter: vercel({ edge: false }) })],
|
||||
};
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
### Enviroment Variables
|
||||
|
||||
- `ENABLE_VC_BUILD`=`1` .
|
||||
|
||||
### You Are Done
|
||||
|
||||
Create a github repo and push your code to it, then deploy it to vercel (:
|
||||
32
apps/examples/solid-start/package.json
Normal file
32
apps/examples/solid-start/package.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "my-app",
|
||||
"scripts": {
|
||||
"dev": "solid-start dev",
|
||||
"build": "solid-start build",
|
||||
"start": "solid-start start",
|
||||
"lint": "eslint --fix \"**/*.{ts,tsx,js,jsx}\""
|
||||
},
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^10.4.13",
|
||||
"postcss": "^8.4.19",
|
||||
"solid-start-node": "^0.2.9",
|
||||
"solid-start-vercel": "^0.2.9",
|
||||
"tailwindcss": "^3.2.4",
|
||||
"typescript": "^4.8.3",
|
||||
"vite": "^3.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@auth/core": "^0.1.4",
|
||||
"@solid-auth/next": "^0.0.19",
|
||||
"@solidjs/meta": "^0.28.0",
|
||||
"@solidjs/router": "^0.6.0",
|
||||
"solid-js": "^1.5.7",
|
||||
"solid-start": "^0.2.9",
|
||||
"undici": "5.11.0",
|
||||
"zod": "^3.19.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
}
|
||||
6
apps/examples/solid-start/postcss.config.cjs
Normal file
6
apps/examples/solid-start/postcss.config.cjs
Normal file
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
BIN
apps/examples/solid-start/public/favicon.ico
Normal file
BIN
apps/examples/solid-start/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 664 B |
72
apps/examples/solid-start/src/components/NavBar/NavBar.tsx
Normal file
72
apps/examples/solid-start/src/components/NavBar/NavBar.tsx
Normal file
@@ -0,0 +1,72 @@
|
||||
import { Match, Show, Switch, type Component } from "solid-js";
|
||||
import { createServerData$ } from "solid-start/server";
|
||||
import { authOpts } from "~/routes/api/auth/[...solidauth]";
|
||||
import { signIn, signOut } from "@solid-auth/next/client";
|
||||
import { getSession } from "@solid-auth/next";
|
||||
import { A } from "solid-start";
|
||||
|
||||
interface INavBarProps {}
|
||||
|
||||
const NavBar: Component<INavBarProps> = () => {
|
||||
const session = useSession();
|
||||
return (
|
||||
<header class="flex flex-col w-full gap-2 fixed left-2/4 right-2/4 -translate-x-2/4 items-center">
|
||||
<nav class="w-[70vw] sm:w-2/4 lg:w-[40%] p-5 bg-[#0000000d] flex items-center justify-between rounded-lg">
|
||||
<Show
|
||||
when={session()?.user}
|
||||
keyed
|
||||
fallback={
|
||||
<>
|
||||
<p class="text-lg font-semibold">You are not signed in</p>
|
||||
<button
|
||||
class="p-2.5 rounded-lg bg-[#346df1] text-white text-lg font-bold flex items-center justify-center"
|
||||
onClick={() => signIn("github")}
|
||||
>
|
||||
Sign in
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
{(us) => (
|
||||
<>
|
||||
<div class="flex gap-2 items-center">
|
||||
<Show when={us.image} keyed>
|
||||
{(im) => <img src={im} class="w-12 h-12 rounded-full" />}
|
||||
</Show>
|
||||
<div class="flex flex-col">
|
||||
<h3 class="font-bold text-lg">Signed in as</h3>
|
||||
<p class="text-lg font-semibold">{us.name}</p>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => signOut()}
|
||||
class="text-[#555] font-semibold underline"
|
||||
>
|
||||
Sign out
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</Show>
|
||||
</nav>
|
||||
<div class="flex gap-2 items-center">
|
||||
<A class="text-blue-500 font-bold underline" href="/">
|
||||
Home
|
||||
</A>
|
||||
<A class="text-blue-500 font-bold underline" href="/protected">
|
||||
Protected
|
||||
</A>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
|
||||
export default NavBar;
|
||||
|
||||
export const useSession = () => {
|
||||
return createServerData$(
|
||||
async (_, { request }) => {
|
||||
return await getSession(request, authOpts);
|
||||
},
|
||||
{ key: () => ["auth_user"] }
|
||||
);
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user