mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
518 Commits
@auth/core
...
@auth/edge
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea65134a84 | ||
|
|
016b22833c | ||
|
|
67dbbb2cdf | ||
|
|
f87e66f0b3 | ||
|
|
b1c46809f5 | ||
|
|
b9e9722b74 | ||
|
|
57f75c7839 | ||
|
|
e20eb5b583 | ||
|
|
fb7c5f9ef6 | ||
|
|
e986369906 | ||
|
|
f3c64a85c9 | ||
|
|
4f3241f8dd | ||
|
|
65043ba471 | ||
|
|
46c5a97a0e | ||
|
|
9f99066b19 | ||
|
|
e266001c28 | ||
|
|
f1eb45f3c1 | ||
|
|
f621627914 | ||
|
|
2b6ad02bba | ||
|
|
1a23e41bca | ||
|
|
9dfef763fc | ||
|
|
f53c16a454 | ||
|
|
e999511a2e | ||
|
|
2707f9ebfe | ||
|
|
35977bf132 | ||
|
|
578ff21d7e | ||
|
|
ba238796b8 | ||
|
|
56b27de3be | ||
|
|
0bc9b4fe5a | ||
|
|
327061ce70 | ||
|
|
2ed407d6a5 | ||
|
|
e743340612 | ||
|
|
5140857256 | ||
|
|
9c6f81308c | ||
|
|
66184c55eb | ||
|
|
07599ba41d | ||
|
|
c5fc3e66ad | ||
|
|
5dfec49ee8 | ||
|
|
b20182c5fe | ||
|
|
a6d9459a64 | ||
|
|
99035b98f9 | ||
|
|
fabb0525d1 | ||
|
|
28e4328704 | ||
|
|
7ff4d9d280 | ||
|
|
26815f7621 | ||
|
|
fe2c3dc6bf | ||
|
|
c53435af8a | ||
|
|
f29a1f2778 | ||
|
|
a4c3270307 | ||
|
|
645d003d49 | ||
|
|
3f296615c5 | ||
|
|
a7842077ec | ||
|
|
b2e5b9f6a8 | ||
|
|
0681531627 | ||
|
|
ea81c467e9 | ||
|
|
bf2835d38f | ||
|
|
89d230666b | ||
|
|
f86e56f78a | ||
|
|
fe20b943ae | ||
|
|
4678c4d4fc | ||
|
|
3eb3f8f107 | ||
|
|
7fd03f38e3 | ||
|
|
ae44b72765 | ||
|
|
a996ab57e8 | ||
|
|
ebdeaf740d | ||
|
|
c5c8a81462 | ||
|
|
61d30f3dcd | ||
|
|
a9180a752b | ||
|
|
6c4180146e | ||
|
|
ec6c4ea2be | ||
|
|
3dfc86334e | ||
|
|
01d6019638 | ||
|
|
4730429a9f | ||
|
|
a49236ef62 | ||
|
|
96ade948ef | ||
|
|
550507b2d1 | ||
|
|
1eddcf643c | ||
|
|
17d71a04d6 | ||
|
|
3c65e264af | ||
|
|
28d8d4894d | ||
|
|
c6b98a8f08 | ||
|
|
d042f933c6 | ||
|
|
3a85de2c5f | ||
|
|
d47b56743e | ||
|
|
363440e515 | ||
|
|
60c5037ee1 | ||
|
|
97394baed1 | ||
|
|
f94abb8f70 | ||
|
|
bbfc11e74c | ||
|
|
2a70514df1 | ||
|
|
96d666465f | ||
|
|
ecbf0be22e | ||
|
|
87ec13bd00 | ||
|
|
c0f9af4c56 | ||
|
|
c7b36f45a3 | ||
|
|
68ff69f9eb | ||
|
|
23c0a393da | ||
|
|
f130f62a91 | ||
|
|
c111b436d2 | ||
|
|
ea895b8864 | ||
|
|
cfedc3b1a3 | ||
|
|
287a5fc05a | ||
|
|
f3ad659e91 | ||
|
|
48b9a0203e | ||
|
|
39fbccb783 | ||
|
|
f207e94146 | ||
|
|
b845729cdb | ||
|
|
e459d2d7e2 | ||
|
|
db1fd9007c | ||
|
|
0439fc5fc6 | ||
|
|
d0dd2ababc | ||
|
|
ba58d48dba | ||
|
|
a8d76ed440 | ||
|
|
3d7b8720db | ||
|
|
1e886b97bc | ||
|
|
ecb14ccecd | ||
|
|
8cee24d4ab | ||
|
|
0189a197be | ||
|
|
c44bf75c65 | ||
|
|
cf13b6c7e3 | ||
|
|
dc1a79e547 | ||
|
|
78964c115b | ||
|
|
7fa51e2a61 | ||
|
|
a79774f6e8 | ||
|
|
f779f05906 | ||
|
|
3245c02eac | ||
|
|
a8dfc8ebb1 | ||
|
|
1b80a18dd4 | ||
|
|
50a88bb878 | ||
|
|
a359a562ce | ||
|
|
7edb9cf53f | ||
|
|
018b086c4f | ||
|
|
173000a068 | ||
|
|
8fcd46b0fc | ||
|
|
d5d1313914 | ||
|
|
3285d04241 | ||
|
|
fe442522ef | ||
|
|
6c9dfff45f | ||
|
|
ef50916ec2 | ||
|
|
8e771a2993 | ||
|
|
06a7149b66 | ||
|
|
662e0942cb | ||
|
|
91c71a175b | ||
|
|
3b8c75297b | ||
|
|
5d06fa5852 | ||
|
|
e7a52077c5 | ||
|
|
6e4516a9f8 | ||
|
|
8a0b11fcd6 | ||
|
|
f925e0c2a5 | ||
|
|
de4e20cc04 | ||
|
|
65f4b9c942 | ||
|
|
1d29b0d220 | ||
|
|
cd92aa0c82 | ||
|
|
d414e01181 | ||
|
|
43deda5bfb | ||
|
|
7e79d8c509 | ||
|
|
ab051162a7 | ||
|
|
87298a0150 | ||
|
|
d6abccd9a0 | ||
|
|
2f35daae37 | ||
|
|
a0f3b04c43 | ||
|
|
c7dec376a1 | ||
|
|
925a52e0ec | ||
|
|
2318e44de4 | ||
|
|
d73812bce5 | ||
|
|
ee36d09a08 | ||
|
|
0cb7fd2e7c | ||
|
|
3b414bd7b5 | ||
|
|
37bb6ebd2c | ||
|
|
2ecf52c342 | ||
|
|
cda07c239e | ||
|
|
fa60b79abe | ||
|
|
39e1a76e8f | ||
|
|
953ef9d04a | ||
|
|
94f3031765 | ||
|
|
ad7bf07ddf | ||
|
|
f30308ac30 | ||
|
|
6eaaeb15e9 | ||
|
|
8b3f0696a5 | ||
|
|
c69a157832 | ||
|
|
60af446338 | ||
|
|
ce85444760 | ||
|
|
142abe3eea | ||
|
|
da211e6cbe | ||
|
|
79ad6156ed | ||
|
|
28f287d63e | ||
|
|
1ab77d0e11 | ||
|
|
787c1ff7d0 | ||
|
|
208b3b4a43 | ||
|
|
c4f6330f70 | ||
|
|
44127068e1 | ||
|
|
9e3f1aacf7 | ||
|
|
83051c6862 | ||
|
|
f1acab67e6 | ||
|
|
6a31ed3216 | ||
|
|
0998fc0b98 | ||
|
|
bd20d750c2 | ||
|
|
8e29b4df0c | ||
|
|
9632a56d45 | ||
|
|
12161b9613 | ||
|
|
a3b5276a5a | ||
|
|
7c1078b9a9 | ||
|
|
37d3461155 | ||
|
|
6111662df7 | ||
|
|
5da6549c48 | ||
|
|
1ca87809d6 | ||
|
|
7f6967fc3c | ||
|
|
2313ef63e0 | ||
|
|
523fcbab71 | ||
|
|
83d8b447db | ||
|
|
ddffa57d00 | ||
|
|
807d5d7920 | ||
|
|
0f0dd9228a | ||
|
|
b087fdb817 | ||
|
|
443bfd6c32 | ||
|
|
7c44d916ed | ||
|
|
b489fef2e2 | ||
|
|
98add24526 | ||
|
|
0ddd47cc0a | ||
|
|
0100888d9b | ||
|
|
9eeea02fe2 | ||
|
|
0a57fea430 | ||
|
|
51750e1a06 | ||
|
|
039a14d992 | ||
|
|
da821d2789 | ||
|
|
be5c42e350 | ||
|
|
b68f461f8b | ||
|
|
95c5ba0b5d | ||
|
|
25388de027 | ||
|
|
ad77e1c2b7 | ||
|
|
cd654c3001 | ||
|
|
6f9ca4143d | ||
|
|
e97b27414a | ||
|
|
9018939ee7 | ||
|
|
c2fc41b44d | ||
|
|
01d7eb4feb | ||
|
|
2388c20cc6 | ||
|
|
9a1bef9e72 | ||
|
|
35a72d2273 | ||
|
|
5f1b75a7a2 | ||
|
|
fa58065951 | ||
|
|
b31f2af66c | ||
|
|
71bb6f2590 | ||
|
|
6c07331cc5 | ||
|
|
c8ef94b2be | ||
|
|
75a59fbd92 | ||
|
|
3dd47b0735 | ||
|
|
4dc1d421f8 | ||
|
|
99ca67f1cf | ||
|
|
a087df8494 | ||
|
|
1aa4994de6 | ||
|
|
88023f69b9 | ||
|
|
b02057a72d | ||
|
|
400da8c766 | ||
|
|
b48104801b | ||
|
|
ccbbc800d2 | ||
|
|
d7888263ca | ||
|
|
47d3151410 | ||
|
|
7d264860ab | ||
|
|
6184b936f5 | ||
|
|
1954258a0a | ||
|
|
c580f0db22 | ||
|
|
d1cf701ed9 | ||
|
|
69398e2d3a | ||
|
|
856b5c50fc | ||
|
|
2830b7de5b | ||
|
|
40a0faa586 | ||
|
|
a6b4d958ac | ||
|
|
cc13df9d51 | ||
|
|
06b8d4772c | ||
|
|
d644d1fcbf | ||
|
|
380f2de961 | ||
|
|
dc5f3e1873 | ||
|
|
93f3fcd1b7 | ||
|
|
1d9b9ba47c | ||
|
|
8f6108f230 | ||
|
|
15943d6696 | ||
|
|
81589bf738 | ||
|
|
09402bf2fc | ||
|
|
e39a968a7b | ||
|
|
b03378be7f | ||
|
|
af415e9438 | ||
|
|
90eeeeab2f | ||
|
|
f0b475fc72 | ||
|
|
f4f8c4a0b3 | ||
|
|
6f2cb460c9 | ||
|
|
46f285f6f0 | ||
|
|
6bdb8af78d | ||
|
|
04e0637fd8 | ||
|
|
b5712448a1 | ||
|
|
605d15c3cc | ||
|
|
d1479125cb | ||
|
|
2e09bc0d19 | ||
|
|
843fc6ff8f | ||
|
|
6695ff8503 | ||
|
|
80c1f375b8 | ||
|
|
5a13288d47 | ||
|
|
26201e6271 | ||
|
|
d0d7b90ba1 | ||
|
|
874624dfbe | ||
|
|
4b5cd08800 | ||
|
|
1c104afef9 | ||
|
|
ff5b8ba8e2 | ||
|
|
42d5899efd | ||
|
|
b278975c3f | ||
|
|
997e595b5b | ||
|
|
527c25b128 | ||
|
|
0e2bbda537 | ||
|
|
7f3b35593f | ||
|
|
bce6b00c43 | ||
|
|
1bbd5d51d1 | ||
|
|
b24b02fe71 | ||
|
|
2c5c4d18c4 | ||
|
|
e3f9b398f0 | ||
|
|
ab13930020 | ||
|
|
f6bb16b264 | ||
|
|
a220245d03 | ||
|
|
7462e797de | ||
|
|
36286b1fae | ||
|
|
2e8e90a9be | ||
|
|
d06a552bf6 | ||
|
|
5cb8dd5f37 | ||
|
|
7c1a3b547e | ||
|
|
2534ae8801 | ||
|
|
14a120277b | ||
|
|
c49f484743 | ||
|
|
676b39d5b1 | ||
|
|
e27dbcab2f | ||
|
|
63805c7d75 | ||
|
|
5d1c35e8aa | ||
|
|
a77f557cbf | ||
|
|
657492d921 | ||
|
|
d1d63bddba | ||
|
|
99ac4899b5 | ||
|
|
2130765a57 | ||
|
|
4079274aaf | ||
|
|
3d7985fd6d | ||
|
|
331e0ce51e | ||
|
|
8af666a4cc | ||
|
|
fed0a67917 | ||
|
|
0332d86942 | ||
|
|
8b38d32430 | ||
|
|
1e5f840a26 | ||
|
|
5981712681 | ||
|
|
dd2b85c6a5 | ||
|
|
3c0475acae | ||
|
|
416881c4c9 | ||
|
|
b91167091c | ||
|
|
497dacff41 | ||
|
|
2a1e1d1cd2 | ||
|
|
00f65b3476 | ||
|
|
470e55f8db | ||
|
|
d722962206 | ||
|
|
cee1bddbd5 | ||
|
|
e0ae913e5c | ||
|
|
1db27fcd07 | ||
|
|
95407df289 | ||
|
|
22adc2eb3c | ||
|
|
725f976b39 | ||
|
|
28ae5d4639 | ||
|
|
0f4d43e9ad | ||
|
|
28583b8ab0 | ||
|
|
1e7538a955 | ||
|
|
4258857e52 | ||
|
|
e9d8805609 | ||
|
|
fb43c5da05 | ||
|
|
326eadf0ed | ||
|
|
a5e0db4bb3 | ||
|
|
334e23343a | ||
|
|
be046a6cb2 | ||
|
|
bdee262abe | ||
|
|
3f89e668ec | ||
|
|
533320eb94 | ||
|
|
dfe6509472 | ||
|
|
1bde7cc8df | ||
|
|
cef05d5e2d | ||
|
|
c0dea283ba | ||
|
|
0204766e0f | ||
|
|
a336ba762c | ||
|
|
681d53c2f8 | ||
|
|
06e891c0ea | ||
|
|
b9a84350b5 | ||
|
|
44c38247da | ||
|
|
9b9af4d5e5 | ||
|
|
fd2179bdca | ||
|
|
7bb037bb9d | ||
|
|
52f70e9f4f | ||
|
|
505f69b519 | ||
|
|
b21709db40 | ||
|
|
aff7b37ef9 | ||
|
|
daa85be1ad | ||
|
|
c31718ca10 | ||
|
|
fbcfedf0e8 | ||
|
|
bd032335eb | ||
|
|
128e0f3a10 | ||
|
|
557fb9d741 | ||
|
|
b4d6ed5f5f | ||
|
|
035836da98 | ||
|
|
294039a497 | ||
|
|
b2450ef625 | ||
|
|
a81bb3e51e | ||
|
|
bb506f7eb9 | ||
|
|
87d9cc4244 | ||
|
|
d2e3b76031 | ||
|
|
c36834b3b0 | ||
|
|
8f7145801a | ||
|
|
fdce27b8ca | ||
|
|
4056dafa7a | ||
|
|
f0b61bd5fd | ||
|
|
866e42b343 | ||
|
|
6d4cde4b02 | ||
|
|
2377596bb6 | ||
|
|
3c7c25cefa | ||
|
|
c441f681af | ||
|
|
c05951f0f9 | ||
|
|
d142252499 | ||
|
|
700daec919 | ||
|
|
d8481f3825 | ||
|
|
3539a35601 | ||
|
|
3be7bb7a79 | ||
|
|
031cdd13b2 | ||
|
|
212b321f7e | ||
|
|
1ccb88b3f0 | ||
|
|
16d680b110 | ||
|
|
6e027811ef | ||
|
|
e5df406429 | ||
|
|
e4ddb533ff | ||
|
|
4e16b21a60 | ||
|
|
dd9f1b7421 | ||
|
|
4ebec5d385 | ||
|
|
c1f3cbda3c | ||
|
|
ba3ed049d1 | ||
|
|
9238294192 | ||
|
|
83c6bfe237 | ||
|
|
07109616c8 | ||
|
|
95c8f7930e | ||
|
|
8005f0cdb0 | ||
|
|
6e0ae59ed3 | ||
|
|
1b19aa39b8 | ||
|
|
69cda58707 | ||
|
|
b20a5f554a | ||
|
|
f8d77c4daf | ||
|
|
a3d23450a8 | ||
|
|
9abee0b2ee | ||
|
|
5cf580d10b | ||
|
|
00d495d9e3 | ||
|
|
5884574765 | ||
|
|
ae5360b028 | ||
|
|
7c963515b5 | ||
|
|
8cf4cc2ea9 | ||
|
|
9388a56efa | ||
|
|
3a75fb955a | ||
|
|
01bb91612a | ||
|
|
3b25935c83 | ||
|
|
394920dfd4 | ||
|
|
85dc5bede8 | ||
|
|
8f854c61d0 | ||
|
|
e8fbe58997 | ||
|
|
d2288ee4cc | ||
|
|
5a6f76bf2c | ||
|
|
15bed6260c | ||
|
|
1423733d61 | ||
|
|
77d8f47f51 | ||
|
|
3120d28299 | ||
|
|
e6a320bb0f | ||
|
|
7d4d436efe | ||
|
|
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 | ||
|
|
bcf909b69e | ||
|
|
4dcdd21242 | ||
|
|
137d993a13 | ||
|
|
8dda662cd6 | ||
|
|
8a438bab32 | ||
|
|
4aaad03e9c | ||
|
|
4fa0d1fa2a | ||
|
|
c081773667 | ||
|
|
1ab0a2aed4 | ||
|
|
cac9816d32 | ||
|
|
65defc709e | ||
|
|
1601626d31 | ||
|
|
8c4f439279 |
@@ -1,70 +0,0 @@
|
|||||||
.eslintrc.js
|
|
||||||
.cache-loader
|
|
||||||
.DS_Store
|
|
||||||
.pnpm-debug.log
|
|
||||||
.turbo
|
|
||||||
.vscode/generated*
|
|
||||||
/_work
|
|
||||||
/actions-runner
|
|
||||||
node_modules
|
|
||||||
patches
|
|
||||||
pnpm-lock.yaml
|
|
||||||
.github/actions/issue-validator/index.mjs
|
|
||||||
*.cjs
|
|
||||||
*.js
|
|
||||||
*.d.ts
|
|
||||||
*.d.ts.map
|
|
||||||
|
|
||||||
.svelte-kit
|
|
||||||
.next
|
|
||||||
.nuxt
|
|
||||||
|
|
||||||
# --------------- Docs ---------------
|
|
||||||
|
|
||||||
.docusaurus
|
|
||||||
build
|
|
||||||
docs/docs/reference/03-core
|
|
||||||
docs/docs/reference/04-sveltekit
|
|
||||||
static
|
|
||||||
|
|
||||||
# --------------- Packages ---------------
|
|
||||||
|
|
||||||
coverage
|
|
||||||
dist
|
|
||||||
|
|
||||||
# @auth/core
|
|
||||||
packages/core/src/providers/oauth-types.ts
|
|
||||||
packages/core/src/lib/pages/styles.ts
|
|
||||||
|
|
||||||
# @auth/sveltekit
|
|
||||||
packages/frameworks-sveltekit/package
|
|
||||||
packages/frameworks-sveltekit/vite.config.{js,ts}.timestamp-*
|
|
||||||
|
|
||||||
# next-auth
|
|
||||||
packages/next-auth/src/providers/oauth-types.ts
|
|
||||||
packages/next-auth/css/index.css
|
|
||||||
|
|
||||||
|
|
||||||
# Adapters
|
|
||||||
.branches
|
|
||||||
db.sqlite
|
|
||||||
dev.db
|
|
||||||
dynamodblocal-bin
|
|
||||||
firebase-debug.log
|
|
||||||
firestore-debug.log
|
|
||||||
migrations
|
|
||||||
test.schema.gql
|
|
||||||
|
|
||||||
# --------------- Apps ---------------
|
|
||||||
|
|
||||||
|
|
||||||
# Examples should have their own Prettier config since they are templates too
|
|
||||||
apps/example-sveltekit
|
|
||||||
|
|
||||||
# Development app
|
|
||||||
apps
|
|
||||||
|
|
||||||
|
|
||||||
# --------------- Tests ---------------
|
|
||||||
# TODO: these should be linted
|
|
||||||
packages/**/*test*
|
|
||||||
75
.eslintrc.js
75
.eslintrc.js
@@ -1,75 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
|
|
||||||
/** @type {import("eslint").ESLint.ConfigData} */
|
|
||||||
module.exports = {
|
|
||||||
env: { browser: true, es2022: true, node: true },
|
|
||||||
extends: ["eslint:recommended", "prettier"],
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ["*.ts", "*.tsx"],
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
parserOptions: {
|
|
||||||
project: ["./packages/**/tsconfig.json", "./apps/**/tsconfig.json"],
|
|
||||||
},
|
|
||||||
settings: { react: { version: "18" } },
|
|
||||||
extends: [
|
|
||||||
"plugin:react/recommended",
|
|
||||||
"plugin:react/jsx-runtime",
|
|
||||||
"standard-with-typescript",
|
|
||||||
"prettier",
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
"@typescript-eslint/explicit-function-return-type": "off",
|
|
||||||
"@typescript-eslint/method-signature-style": "off",
|
|
||||||
"@typescript-eslint/naming-convention": "off",
|
|
||||||
"@typescript-eslint/no-non-null-assertion": "off",
|
|
||||||
"@typescript-eslint/restrict-template-expressions": "off",
|
|
||||||
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
||||||
"react/prop-types": "off",
|
|
||||||
"react/no-unescaped-entities": "off",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ["*.test.ts", "*.test.js"],
|
|
||||||
extends: ["plugin:jest/recommended"],
|
|
||||||
env: { jest: true },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ["docs/**"],
|
|
||||||
plugins: ["@docusaurus"],
|
|
||||||
extends: ["plugin:@docusaurus/recommended"],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// TODO: Expand to all packages
|
|
||||||
files: ["packages/{core,sveltekit}/*.ts"],
|
|
||||||
plugins: ["jsdoc"],
|
|
||||||
extends: ["plugin:jsdoc/recommended"],
|
|
||||||
rules: {
|
|
||||||
"jsdoc/require-param": "off",
|
|
||||||
"jsdoc/require-returns": "off",
|
|
||||||
"jsdoc/require-jsdoc": [
|
|
||||||
"warn",
|
|
||||||
{ publicOnly: true, enableFixer: false },
|
|
||||||
],
|
|
||||||
"jsdoc/no-multi-asterisks": ["warn", { allowWhitespace: true }],
|
|
||||||
"jsdoc/tag-lines": "off",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ["packages/frameworks-sveltekit"],
|
|
||||||
plugins: ["svelte3"],
|
|
||||||
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
|
|
||||||
settings: {
|
|
||||||
"svelte3/typescript": () => require("typescript"),
|
|
||||||
},
|
|
||||||
parserOptions: { sourceType: "module", ecmaVersion: 2020 },
|
|
||||||
env: { browser: true, es2017: true, node: true },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
parserOptions: {
|
|
||||||
sourceType: "module",
|
|
||||||
ecmaVersion: "latest",
|
|
||||||
ecmaFeatures: { jsx: true },
|
|
||||||
},
|
|
||||||
root: true,
|
|
||||||
}
|
|
||||||
4
.github/ISSUE_TEMPLATE/1_bug_framework.yml
vendored
4
.github/ISSUE_TEMPLATE/1_bug_framework.yml
vendored
@@ -11,7 +11,7 @@ body:
|
|||||||
|
|
||||||
### Important :exclamation:
|
### Important :exclamation:
|
||||||
|
|
||||||
_Providing incorrect/insufficient information or skipping steps to reproduce the issue may result in closing the issue or converting to a discussion without further explanation._
|
_Providing incorrect/insufficient information or skipping steps to reproduce the issue will result in closing the issue and/or converting to a discussion without further explanation._
|
||||||
|
|
||||||
If you have a generic question specific to your project, it is best asked in Discussions under the [Questions category](https://github.com/nextauthjs/next-auth/discussions/new?category=Questions)
|
If you have a generic question specific to your project, it is best asked in Discussions under the [Questions category](https://github.com/nextauthjs/next-auth/discussions/new?category=Questions)
|
||||||
# Let's wait with this until adoption in other frameworks.
|
# Let's wait with this until adoption in other frameworks.
|
||||||
@@ -30,7 +30,7 @@ body:
|
|||||||
Run this command in your project's root folder and paste the result:
|
Run this command in your project's root folder and paste the result:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth"
|
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth,@auth/*"
|
||||||
```
|
```
|
||||||
Alternatively, you can manually gather the version information from your package.json for these packages: "next", "react" and "next-auth". Please also mention your OS and Node.js version, as well as the browser you are using.
|
Alternatively, you can manually gather the version information from your package.json for these packages: "next", "react" and "next-auth". Please also mention your OS and Node.js version, as well as the browser you are using.
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
11
.github/ISSUE_TEMPLATE/2_bug_provider.yml
vendored
11
.github/ISSUE_TEMPLATE/2_bug_provider.yml
vendored
@@ -25,17 +25,23 @@ body:
|
|||||||
- "Custom provider"
|
- "Custom provider"
|
||||||
- "42 School"
|
- "42 School"
|
||||||
- "Apple"
|
- "Apple"
|
||||||
|
- "Asgardeo"
|
||||||
- "Atlassian"
|
- "Atlassian"
|
||||||
- "Auth0"
|
- "Auth0"
|
||||||
- "Authentik"
|
- "Authentik"
|
||||||
- "Azure Active Directory"
|
- "Azure Active Directory"
|
||||||
- "Azure Active Directory B2C"
|
- "Azure Active Directory B2C"
|
||||||
|
- "Azure DevOps"
|
||||||
- "Battlenet"
|
- "Battlenet"
|
||||||
|
- "Beyond Identity"
|
||||||
- "Box"
|
- "Box"
|
||||||
- "Bungie"
|
- "Bungie"
|
||||||
|
- "ClickUp"
|
||||||
- "Cognito"
|
- "Cognito"
|
||||||
- "Coinbase"
|
- "Coinbase"
|
||||||
|
- "Descope"
|
||||||
- "Discord"
|
- "Discord"
|
||||||
|
- "Dribbble"
|
||||||
- "Dropbox"
|
- "Dropbox"
|
||||||
- "EVE Online"
|
- "EVE Online"
|
||||||
- "Facebook"
|
- "Facebook"
|
||||||
@@ -54,9 +60,11 @@ body:
|
|||||||
- "LinkedIn"
|
- "LinkedIn"
|
||||||
- "Mailchimp"
|
- "Mailchimp"
|
||||||
- "Mail.ru"
|
- "Mail.ru"
|
||||||
|
- "Mastodon"
|
||||||
- "Medium"
|
- "Medium"
|
||||||
- "Naver"
|
- "Naver"
|
||||||
- "Netlify"
|
- "Netlify"
|
||||||
|
- "Notion"
|
||||||
- "Okta"
|
- "Okta"
|
||||||
- "OneLogin"
|
- "OneLogin"
|
||||||
- "Osso"
|
- "Osso"
|
||||||
@@ -68,6 +76,7 @@ body:
|
|||||||
- "Slack"
|
- "Slack"
|
||||||
- "Spotify"
|
- "Spotify"
|
||||||
- "Strava"
|
- "Strava"
|
||||||
|
- "Tiktok"
|
||||||
- "Todoist"
|
- "Todoist"
|
||||||
- "Trakt"
|
- "Trakt"
|
||||||
- "Twitch"
|
- "Twitch"
|
||||||
@@ -87,7 +96,7 @@ body:
|
|||||||
Run this command in your project's root folder and paste the result:
|
Run this command in your project's root folder and paste the result:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth"
|
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth,@auth/*"
|
||||||
```
|
```
|
||||||
Alternatively, you can manually gather the version information from your package.json for these packages: "next", "react" and "next-auth". Please also mention your OS and Node.js version, as well as the browser you are using.
|
Alternatively, you can manually gather the version information from your package.json for these packages: "next", "react" and "next-auth". Please also mention your OS and Node.js version, as well as the browser you are using.
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
32
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
32
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
@@ -21,20 +21,22 @@ body:
|
|||||||
multiple: true
|
multiple: true
|
||||||
options:
|
options:
|
||||||
- "Custom adapter"
|
- "Custom adapter"
|
||||||
- "@next-auth/dgraph-adapter"
|
- "@auth/dgraph-adapter"
|
||||||
- "@next-auth/dynamodb-adapter"
|
- "@auth/drizzle-adapter"
|
||||||
- "@next-auth/fauna-adapter"
|
- "@auth/dynamodb-adapter"
|
||||||
- "@next-auth/firebase-adapter"
|
- "@auth/fauna-adapter"
|
||||||
- "@next-auth/mikro-orm-adapter"
|
- "@auth/firebase-adapter"
|
||||||
- "@next-auth/mongodb-adapter"
|
- "@auth/kysely-adapter"
|
||||||
- "@next-auth/neo4j-adapter"
|
- "@auth/mikro-orm-adapter"
|
||||||
- "@next-auth/pouchdb-adapter"
|
- "@auth/mongodb-adapter"
|
||||||
- "@next-auth/prisma-adapter"
|
- "@auth/neo4j-adapter"
|
||||||
- "@next-auth/sequelize-adapter"
|
- "@auth/pouchdb-adapter"
|
||||||
- "@next-auth/supabase-adapter"
|
- "@auth/prisma-adapter"
|
||||||
- "@next-auth/typeorm-legacy-adapter"
|
- "@auth/sequelize-adapter"
|
||||||
- "@next-auth/upstash-redis-adapter"
|
- "@auth/supabase-adapter"
|
||||||
- "@next-auth/xata-adapter"
|
- "@auth/typeorm-adapter"
|
||||||
|
- "@auth/upstash-redis-adapter"
|
||||||
|
- "@auth/xata-adapter"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
@@ -44,7 +46,7 @@ body:
|
|||||||
Run this command in your project's root folder and paste the result:
|
Run this command in your project's root folder and paste the result:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth" && npx envinfo --npmPackages "@next-auth/*"
|
npx envinfo --system --binaries --browsers --npmPackages "next,react,next-auth,@auth/*" && npx envinfo --npmPackages "@next-auth/*"
|
||||||
```
|
```
|
||||||
Alternatively, if the above command did not work, we need the version of the following packages from your package.json: "next", "react", "next-auth" and your adapter. Please also mention your OS and Node.js version, as well as the browser you are using.
|
Alternatively, if the above command did not work, we need the version of the following packages from your package.json: "next", "react", "next-auth" and your adapter. Please also mention your OS and Node.js version, as well as the browser you are using.
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -8,7 +8,7 @@ merge of your pull request!
|
|||||||
> _NOTE_:
|
> _NOTE_:
|
||||||
>
|
>
|
||||||
> - It's a good idea to open an issue first to discuss potential changes.
|
> - 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
|
## ☕️ Reasoning
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ Fixes: INSERT_ISSUE_LINK_HERE
|
|||||||
|
|
||||||
## 📌 Resources
|
## 📌 Resources
|
||||||
|
|
||||||
- [Security guidelines](../Security.md)
|
- [Security guidelines](https://github.com/nextauthjs/.github/blob/main/SECURITY.md)
|
||||||
- [Contributing guidelines](../CONTRIBUTING.md)
|
- [Contributing guidelines](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md)
|
||||||
- [Code of conduct](../CODE_OF_CONDUCT.md)
|
- [Code of conduct](https://github.com/nextauthjs/.github/blob/main/CODE_OF_CONDUCT.md)
|
||||||
- [Contributing to Open Source](https://kcd.im/pull-request)
|
- [Contributing to Open Source](https://kcd.im/pull-request)
|
||||||
|
|||||||
2
.github/actions/issue-validator/index.mjs
vendored
2
.github/actions/issue-validator/index.mjs
vendored
File diff suppressed because one or more lines are too long
3
.github/actions/issue-validator/licenses.txt
vendored
3
.github/actions/issue-validator/licenses.txt
vendored
@@ -526,7 +526,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||||||
root
|
root
|
||||||
ISC License
|
ISC License
|
||||||
|
|
||||||
Copyright (c) 2018-2021, Iain Collins
|
Copyright (c) 2022-2023, Balázs Orbán
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -540,6 +540,7 @@ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
tr46
|
tr46
|
||||||
MIT
|
MIT
|
||||||
|
|
||||||
|
|||||||
4
.github/actions/issue-validator/repro.md
vendored
4
.github/actions/issue-validator/repro.md
vendored
@@ -14,9 +14,9 @@ Ensure the link is pointing to a codebase that is accessible (e.g. not a private
|
|||||||
|
|
||||||
### **What happens if I don't provide a sufficient minimal reproduction?**
|
### **What happens if I don't provide a sufficient minimal reproduction?**
|
||||||
|
|
||||||
Issues with the `incomplete` label that receives no meaningful activity (e.g. new comments with a reproduction link) are automatically closed and locked after 30 days.
|
Issues with the `incomplete` label that receives no meaningful activity (e.g. new comments with a reproduction link) are closed after 7 days.
|
||||||
|
|
||||||
If your issue has _not_ been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction.
|
If your issue has _not_ been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction. (It's less likely that we check back on already closed issues.)
|
||||||
|
|
||||||
### **I did not open this issue, but it is relevant to me, what can I do to help?**
|
### **I did not open this issue, but it is relevant to me, what can I do to help?**
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ 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"
|
||||||
|
|
||||||
@@ -70,7 +71,12 @@ async function run() {
|
|||||||
}),
|
}),
|
||||||
client.issues.createComment({
|
client.issues.createComment({
|
||||||
...issueCommon,
|
...issueCommon,
|
||||||
body: readFileSync("repro.md", "utf8"),
|
body: readFileSync(
|
||||||
|
join(
|
||||||
|
"/home/runner/work/next-auth/next-auth/.github/actions/issue-validator/repro.md"
|
||||||
|
),
|
||||||
|
"utf8"
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
return core.info(
|
return core.info(
|
||||||
|
|||||||
36
.github/issue-labeler.yml
vendored
36
.github/issue-labeler.yml
vendored
@@ -1,43 +1,49 @@
|
|||||||
# https://github.com/github/issue-labeler#basic-examples
|
# https://github.com/github/issue-labeler#basic-examples
|
||||||
|
|
||||||
dgraph:
|
dgraph:
|
||||||
- "@next-auth/dgraph-adapter"
|
- "@auth/dgraph-adapter"
|
||||||
|
|
||||||
|
drizzle:
|
||||||
|
- "@auth/drizzle-adapter"
|
||||||
|
|
||||||
dynamodb:
|
dynamodb:
|
||||||
- "@next-auth/dynamodb-adapter"
|
- "@auth/dynamodb-adapter"
|
||||||
|
|
||||||
fauna:
|
fauna:
|
||||||
- "@next-auth/fauna-adapter"
|
- "@auth/fauna-adapter"
|
||||||
|
|
||||||
firebase:
|
firebase:
|
||||||
- "@next-auth/firebase-adapter"
|
- "@auth/firebase-adapter"
|
||||||
|
|
||||||
|
kysely:
|
||||||
|
- "@auth/kysely-adapter"
|
||||||
|
|
||||||
mikro-orm:
|
mikro-orm:
|
||||||
- "@next-auth/mikro-orm-adapter"
|
- "@auth/mikro-orm-adapter"
|
||||||
|
|
||||||
mongodb:
|
mongodb:
|
||||||
- "@next-auth/mongodb-adapter"
|
- "@auth/mongodb-adapter"
|
||||||
|
|
||||||
neo4j:
|
neo4j:
|
||||||
- "@next-auth/neo4j-adapter"
|
- "@auth/neo4j-adapter"
|
||||||
|
|
||||||
pouchdb:
|
pouchdb:
|
||||||
- "@next-auth/pouchdb-adapter"
|
- "@auth/pouchdb-adapter"
|
||||||
|
|
||||||
prisma:
|
prisma:
|
||||||
- "@next-auth/prisma-adapter"
|
- "@auth/prisma-adapter"
|
||||||
|
|
||||||
sequelize:
|
sequelize:
|
||||||
- "@next-auth/sequelize-adapter"
|
- "@auth/sequelize-adapter"
|
||||||
|
|
||||||
supabase:
|
supabase:
|
||||||
- "@next-auth/supabase-adapter"
|
- "@auth/supabase-adapter"
|
||||||
|
|
||||||
typeorm-legacy:
|
typeorm:
|
||||||
- "@next-auth/typeorm-legacy-adapter"
|
- "@auth/typeorm-adapter"
|
||||||
|
|
||||||
upstash-redis:
|
upstash-redis:
|
||||||
- "@next-auth/upstash-redis-adapter"
|
- "@auth/upstash-redis-adapter"
|
||||||
|
|
||||||
xata:
|
xata:
|
||||||
- "@next-auth/xata-adapter"
|
- "@auth/xata-adapter"
|
||||||
|
|||||||
99
.github/pr-labeler.yml
vendored
99
.github/pr-labeler.yml
vendored
@@ -1,74 +1,27 @@
|
|||||||
# https://github.com/actions/labeler#create-githublabeleryml
|
# https://github.com/actions/labeler#create-githublabeleryml
|
||||||
|
adapters: ["packages/core/src/adapters.ts", "packages/adapter-*/**/*"]
|
||||||
test:
|
core: ["packages/core/src/**/*"]
|
||||||
- test/**/*
|
dgraph: ["packages/adapter-dgraph/**/*"]
|
||||||
- types/tests/**/*
|
documentation: ["packages/docs/docs/**/*"]
|
||||||
|
dynamodb: ["packages/adapter-dynamodb/**/*"]
|
||||||
providers:
|
examples: ["apps/examples/**/*"]
|
||||||
- packages/next-auth/src/providers/**/*
|
fauna: ["packages/adapter-fauna/**/*"]
|
||||||
- test/integration/**/*
|
firebase: ["packages/adapter-firebase/**/*"]
|
||||||
|
frameworks: ["packages/frameworks-*/**/*"]
|
||||||
adapters:
|
legacy: ["packages/next-auth/**/*"]
|
||||||
- packages/next-auth/src/adapters.ts
|
mikro-orm: ["packages/adapter-mikro-orm/**/*"]
|
||||||
- packages/adapter-*/**
|
mongodb: ["packages/adapter-mongodb/**/*"]
|
||||||
|
neo4j: ["packages/adapter-neo4j/**/*"]
|
||||||
dgraph:
|
playgrounds: ["apps/playgrounds/**/*"]
|
||||||
- packages/adapter-dgraph/**
|
pouchdb: ["packages/adapter-pouchdb/**/*"]
|
||||||
|
prisma: ["packages/adapter-prisma/**/*"]
|
||||||
dynamodb:
|
kysely: ["packages/adapter-kysely/**/*"]
|
||||||
- packages/adapter-dynamodb/**
|
providers: ["packages/core/src/providers/**/*"]
|
||||||
|
sequelize: ["packages/adapter-sequelize/**/*"]
|
||||||
fauna:
|
solidjs: ["packages/frameworks-solid-start/**/*"]
|
||||||
- packages/adapter-fauna/**
|
supabase: ["packages/adapter-supabase/**/*"]
|
||||||
|
svelte: ["packages/frameworks-sveltekit/**/*"]
|
||||||
firebase:
|
test: ["**test**/*"]
|
||||||
- packages/adapter-firebase/**
|
typeorm: ["packages/adapter-typeorm/**/*"]
|
||||||
|
upstash-redis: ["packages/adapter-upstash-redis/**/*"]
|
||||||
mikro-orm:
|
xata: ["packages/adapter-xata/**/*"]
|
||||||
- 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/**/*
|
|
||||||
|
|||||||
20
.github/sync.yml
vendored
20
.github/sync.yml
vendored
@@ -1,14 +1,26 @@
|
|||||||
# Note that nextauthjs/next-auth-example syncs from the v4 branch
|
|
||||||
|
|
||||||
nextauthjs/sveltekit-auth-example:
|
nextauthjs/sveltekit-auth-example:
|
||||||
- source: apps/example-sveltekit
|
- source: apps/examples/sveltekit
|
||||||
|
dest: .
|
||||||
|
deleteOrphaned: true
|
||||||
|
- .github/FUNDING.yml
|
||||||
|
- LICENSE
|
||||||
|
|
||||||
|
nextauthjs/solid-start-auth-example:
|
||||||
|
- source: "apps/examples/solid-start"
|
||||||
dest: .
|
dest: .
|
||||||
deleteOrphaned: true
|
deleteOrphaned: true
|
||||||
- .github/FUNDING.yml
|
- .github/FUNDING.yml
|
||||||
- LICENSE
|
- LICENSE
|
||||||
|
|
||||||
nextauthjs/next-auth-gatsby-example:
|
nextauthjs/next-auth-gatsby-example:
|
||||||
- source: apps/playground-gatsby
|
- source: apps/playgrounds/gatsby
|
||||||
|
dest: .
|
||||||
|
deleteOrphaned: true
|
||||||
|
- .github/FUNDING.yml
|
||||||
|
- LICENSE
|
||||||
|
|
||||||
|
nextauthjs/next-auth-example:
|
||||||
|
- source: apps/examples/nextjs
|
||||||
dest: .
|
dest: .
|
||||||
deleteOrphaned: true
|
deleteOrphaned: true
|
||||||
- .github/FUNDING.yml
|
- .github/FUNDING.yml
|
||||||
|
|||||||
9
.github/version-pr/index.js
vendored
9
.github/version-pr/index.js
vendored
@@ -5,14 +5,15 @@ const core = require("@actions/core")
|
|||||||
try {
|
try {
|
||||||
const packageJSONPath = path.join(
|
const packageJSONPath = path.join(
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
"packages/next-auth/package.json"
|
`packages/${process.env.PACKAGE_PATH || "next-auth"}/package.json`
|
||||||
)
|
)
|
||||||
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, "utf8"))
|
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, "utf8"))
|
||||||
|
|
||||||
const sha8 = process.env.GITHUB_SHA.substring(0, 8)
|
const sha8 = process.env.GITHUB_SHA.substring(0, 8)
|
||||||
const prNumber = process.env.PR_NUMBER
|
const prefix = "0.0.0-"
|
||||||
|
const pr = process.env.PR_NUMBER
|
||||||
const packageVersion = `0.0.0-pr.${prNumber}.${sha8}`
|
const source = pr ? `pr.${pr}` : "manual"
|
||||||
|
const packageVersion = `${prefix}${source}.${sha8}`
|
||||||
packageJSON.version = packageVersion
|
packageJSON.version = packageVersion
|
||||||
core.setOutput("version", packageVersion)
|
core.setOutput("version", packageVersion)
|
||||||
fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON))
|
fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON))
|
||||||
|
|||||||
2
.github/workflows/issue-validator.yml
vendored
2
.github/workflows/issue-validator.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
- name: "Run issue validator"
|
- name: Run issue validator
|
||||||
run: node /home/runner/work/next-auth/next-auth/.github/actions/issue-validator/index.mjs
|
run: node /home/runner/work/next-auth/next-auth/.github/actions/issue-validator/index.mjs
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
111
.github/workflows/release.yml
vendored
111
.github/workflows/release.yml
vendored
@@ -3,11 +3,62 @@ name: Release
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- main
|
||||||
- "beta"
|
- beta
|
||||||
- "next"
|
- next
|
||||||
- "3.x"
|
- 3.x
|
||||||
pull_request:
|
pull_request:
|
||||||
|
# TODO: Support latest releases
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
name:
|
||||||
|
type: choice
|
||||||
|
description: Package name (npm)
|
||||||
|
options:
|
||||||
|
- "@auth/core"
|
||||||
|
- "@auth/dgraph-adapter"
|
||||||
|
- "@auth/drizzle-adapter"
|
||||||
|
- "@auth/dynamodb-adapter"
|
||||||
|
- "@auth/fauna-adapter"
|
||||||
|
- "@auth/firebase-adapter"
|
||||||
|
- "@auth/mikro-orm-adapter"
|
||||||
|
- "@auth/mongodb-adapter"
|
||||||
|
- "@auth/neo4j-adapter"
|
||||||
|
- "@auth/pouchdb-adapter"
|
||||||
|
- "@auth/prisma-adapter"
|
||||||
|
- "@auth/sequelize-adapter"
|
||||||
|
- "@auth/supabase-adapter"
|
||||||
|
- "@auth/typeorm-adapter"
|
||||||
|
- "@auth/upstash-redis-adapter"
|
||||||
|
- "@auth/xata-adapter"
|
||||||
|
- "next-auth"
|
||||||
|
# TODO: Infer from package name
|
||||||
|
path:
|
||||||
|
type: choice
|
||||||
|
description: Directory name (packages/*)
|
||||||
|
options:
|
||||||
|
- "core"
|
||||||
|
- "frameworks-nextjs"
|
||||||
|
- "adapter-dgraph"
|
||||||
|
- "adapter-drizzle"
|
||||||
|
- "adapter-dynamodb"
|
||||||
|
- "adapter-fauna"
|
||||||
|
- "adapter-firebase"
|
||||||
|
- "adapter-mikro-orm"
|
||||||
|
- "adapter-mongodb"
|
||||||
|
- "adapter-neo4j"
|
||||||
|
- "adapter-pouchdb"
|
||||||
|
- "adapter-prisma"
|
||||||
|
- "adapter-sequelize"
|
||||||
|
- "adapter-supabase"
|
||||||
|
- "adapter-typeorm"
|
||||||
|
- "adapter-upstash-redis"
|
||||||
|
- "adapter-xata"
|
||||||
|
- "next-auth"
|
||||||
|
env:
|
||||||
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
|
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||||
|
FORCE_COLOR: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -27,11 +78,30 @@ jobs:
|
|||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
- name: Build
|
||||||
|
run: pnpm build
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: pnpm test
|
run: pnpm test
|
||||||
|
timeout-minutes: 15
|
||||||
env:
|
env:
|
||||||
UPSTASH_REDIS_URL: ${{ secrets.UPSTASH_REDIS_URL }}
|
UPSTASH_REDIS_URL: ${{ secrets.UPSTASH_REDIS_URL }}
|
||||||
UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }}
|
UPSTASH_REDIS_KEY: ${{ secrets.UPSTASH_REDIS_KEY }}
|
||||||
|
# - name: Run E2E tests
|
||||||
|
# if: github.repository == 'nextauthjs/next-auth'
|
||||||
|
# run: pnpm e2e
|
||||||
|
# timeout-minutes: 15
|
||||||
|
# env:
|
||||||
|
# AUTH0_USERNAME: ${{ secrets.AUTH0_USERNAME }}
|
||||||
|
# AUTH0_PASSWORD: ${{ secrets.AUTH0_PASSWORD }}
|
||||||
|
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
|
# TURBO_TEAM: ${{ vars.TURBO_TEAM }}
|
||||||
|
# - name: Upload E2E artifacts
|
||||||
|
# if: github.repository == 'nextauthjs/next-auth'
|
||||||
|
# uses: actions/upload-artifact@v3
|
||||||
|
# with:
|
||||||
|
# name: playwright-report
|
||||||
|
# path: apps/dev/nextjs/playwright-report/
|
||||||
|
# retention-days: 30
|
||||||
# - name: Coverage
|
# - name: Coverage
|
||||||
# uses: codecov/codecov-action@v1
|
# uses: codecov/codecov-action@v1
|
||||||
# with:
|
# with:
|
||||||
@@ -106,3 +176,36 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
VERSION: ${{ steps.determine-version.outputs.version }}
|
VERSION: ${{ steps.determine-version.outputs.version }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
|
release-manual:
|
||||||
|
name: Publish manually
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
|
steps:
|
||||||
|
- name: Init
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v2.2.4
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
cache: "pnpm"
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
- name: Determine version
|
||||||
|
uses: ./.github/version-pr
|
||||||
|
id: determine-version
|
||||||
|
env:
|
||||||
|
PACKAGE_PATH: ${{ github.event.inputs.path }}
|
||||||
|
- name: Publish to npm
|
||||||
|
run: |
|
||||||
|
pnpm build
|
||||||
|
cd packages/$PACKAGE_PATH
|
||||||
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
|
||||||
|
pnpm publish --no-git-checks --access public --tag experimental
|
||||||
|
echo "🎉 Experimental release published 📦️ on npm: https://npmjs.com/package/${{ github.event.inputs.name }}/v/${{ env.VERSION }}"
|
||||||
|
echo "Install via: pnpm add ${{ github.event.inputs.name }}@${{ env.VERSION }}"
|
||||||
|
env:
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
PACKAGE_PATH: ${{ github.event.inputs.path }}
|
||||||
|
VERSION: ${{ steps.determine-version.outputs.version }}
|
||||||
|
|||||||
6
.github/workflows/sync-examples.yml
vendored
6
.github/workflows/sync-examples.yml
vendored
@@ -11,9 +11,9 @@ jobs:
|
|||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Run GitHub File Sync
|
- name: Run GitHub File Sync
|
||||||
# Can update to v1 when https://github.com/BetaHuhn/repo-file-sync-action/issues/168 is resolved
|
uses: balazsorban44/repo-file-sync-action@master
|
||||||
uses: BetaHuhn/repo-file-sync-action@v1.16.5
|
|
||||||
with:
|
with:
|
||||||
GH_PAT: ${{ secrets.SYNC_EXAMPLE_PAT }}
|
GH_PAT: ${{ secrets.GH_PAT }}
|
||||||
|
IS_FINE_GRAINED: true
|
||||||
SKIP_PR: true
|
SKIP_PR: true
|
||||||
ORIGINAL_MESSAGE: true
|
ORIGINAL_MESSAGE: true
|
||||||
|
|||||||
33
.gitignore
vendored
33
.gitignore
vendored
@@ -1,19 +1,21 @@
|
|||||||
# Misc
|
# Misc
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.npmrc
|
|
||||||
.eslintcache
|
.eslintcache
|
||||||
.env
|
.env
|
||||||
.env.local
|
.env.local
|
||||||
.env.development.local
|
.env.development.local
|
||||||
.env.test.local
|
.env.test.local
|
||||||
.env.production.local
|
.env.production.local
|
||||||
|
packages/*/.npmrc
|
||||||
|
|
||||||
|
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
firebase-debug.log
|
firebase-debug.log
|
||||||
|
ui-debug.log
|
||||||
.pnpm-debug.log
|
.pnpm-debug.log
|
||||||
|
.husky
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
node_modules
|
node_modules
|
||||||
@@ -34,18 +36,17 @@ packages/next-auth/utils
|
|||||||
packages/next-auth/core
|
packages/next-auth/core
|
||||||
packages/next-auth/jwt
|
packages/next-auth/jwt
|
||||||
packages/next-auth/react
|
packages/next-auth/react
|
||||||
packages/next-auth/adapters.d.ts
|
|
||||||
packages/next-auth/adapters.js
|
|
||||||
packages/next-auth/index.d.ts
|
|
||||||
packages/next-auth/index.js
|
|
||||||
packages/next-auth/next
|
packages/next-auth/next
|
||||||
packages/next-auth/middleware.d.ts
|
packages/*/*.js
|
||||||
packages/next-auth/middleware.js
|
packages/*/*.d.ts
|
||||||
|
packages/*/*.d.ts.map
|
||||||
|
packages/*/lib
|
||||||
|
|
||||||
# Development app
|
# Development app
|
||||||
apps/dev/src/css
|
apps/dev/src/css
|
||||||
apps/dev/prisma/migrations
|
apps/dev/prisma/migrations
|
||||||
apps/dev/typeorm
|
apps/dev/typeorm
|
||||||
|
apps/dev/nextjs-2
|
||||||
|
|
||||||
# VS
|
# VS
|
||||||
/.vs/slnx.sqlite-journal
|
/.vs/slnx.sqlite-journal
|
||||||
@@ -66,6 +67,7 @@ packages/adapter-prisma/prisma/dev.db
|
|||||||
packages/adapter-prisma/prisma/migrations
|
packages/adapter-prisma/prisma/migrations
|
||||||
db.sqlite
|
db.sqlite
|
||||||
packages/adapter-supabase/supabase/.branches
|
packages/adapter-supabase/supabase/.branches
|
||||||
|
packages/adapter-drizzle/.drizzle
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
coverage
|
coverage
|
||||||
@@ -81,13 +83,12 @@ docs/.docusaurus
|
|||||||
docs/providers.json
|
docs/providers.json
|
||||||
|
|
||||||
# Core
|
# Core
|
||||||
packages/core/*.js
|
packages/core/src/providers/oauth-types.ts
|
||||||
packages/core/*.d.ts
|
|
||||||
packages/core/*.d.ts.map
|
|
||||||
packages/core/lib
|
packages/core/lib
|
||||||
packages/core/providers
|
packages/core/providers
|
||||||
docs/docs/reference/03-core
|
packages/core/src/lib/pages/styles.ts
|
||||||
docs/docs/reference/04-sveltekit
|
docs/docs/reference/core
|
||||||
|
docs/docs/reference/sveltekit
|
||||||
|
|
||||||
|
|
||||||
# SvelteKit
|
# SvelteKit
|
||||||
@@ -97,3 +98,9 @@ packages/frameworks-sveltekit/.svelte-kit
|
|||||||
packages/frameworks-sveltekit/package
|
packages/frameworks-sveltekit/package
|
||||||
packages/frameworks-sveltekit/vite.config.js.timestamp-*
|
packages/frameworks-sveltekit/vite.config.js.timestamp-*
|
||||||
packages/frameworks-sveltekit/vite.config.ts.timestamp-*
|
packages/frameworks-sveltekit/vite.config.ts.timestamp-*
|
||||||
|
|
||||||
|
# Adapters
|
||||||
|
docs/docs/reference/adapter
|
||||||
|
|
||||||
|
## Drizzle migration folder
|
||||||
|
.drizzle
|
||||||
@@ -20,9 +20,10 @@ pnpm-lock.yaml
|
|||||||
|
|
||||||
.docusaurus
|
.docusaurus
|
||||||
build
|
build
|
||||||
docs/docs/reference/03-core
|
docs/docs/reference/core
|
||||||
docs/docs/reference/04-sveltekit
|
docs/docs/reference/sveltekit
|
||||||
static
|
static
|
||||||
|
docs/providers.json
|
||||||
|
|
||||||
# --------------- Packages ---------------
|
# --------------- Packages ---------------
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
|
|
||||||
/** @type {import("prettier").Config} */
|
|
||||||
module.exports = {
|
|
||||||
semi: false,
|
|
||||||
singleQuote: false,
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: [
|
|
||||||
"apps/dev/pages/api/auth/[...nextauth].ts",
|
|
||||||
"docs/{sidebars,docusaurus.config}.js",
|
|
||||||
],
|
|
||||||
options: { printWidth: 150 },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
153
README.md
Normal file
153
README.md
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<p align="center">
|
||||||
|
<br/>
|
||||||
|
<a href="https://authjs.dev" target="_blank"><img width="96px" src="https://authjs.dev/img/logo/logo-sm.png" /></a>
|
||||||
|
<h3 align="center">Auth.js</h3>
|
||||||
|
<p align="center">Authentication for the Web.</p>
|
||||||
|
<p align="center">Open Source. Full Stack. Own Your Data.</p>
|
||||||
|
<p align="center" style="align: center;">
|
||||||
|
<a href="https://npm.im/@auth/prisma-adapter">
|
||||||
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
|
</a>
|
||||||
|
<a href="https://www.npmtrends.com/next-auth">
|
||||||
|
<img src="https://img.shields.io/npm/dm/next-auth?style=flat-square" alt="Downloads" />
|
||||||
|
</a>
|
||||||
|
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
||||||
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
</a>
|
||||||
|
<a href="https://www.npmjs.com/package/next-auth">
|
||||||
|
<img src="https://img.shields.io/github/v/release/nextauthjs/next-auth?label=latest&style=flat-square" alt="Github Stable Release" />
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Auth.js is a set of open-source packages that are built on Web Standard APIs for authentication in modern applications with any framework on any platform in any JS runtime.
|
||||||
|
|
||||||
|
See [authjs.dev](https://authjs.dev) for our framework-specific libraries, or check out [next-auth.js.org](https://next-auth.js.org) for `next-auth` (Next.js).
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
### Flexible and easy to use
|
||||||
|
|
||||||
|
- Designed to work with any OAuth service, it supports 2.0+, OIDC
|
||||||
|
- Built-in support for [many popular sign-in services](https://github.com/nextauthjs/next-auth/tree/main/packages/core/src/providers)
|
||||||
|
- Email/Passwordless authentication
|
||||||
|
- Bring Your Database - or none! - stateless authentication with any backend (Active Directory, LDAP, etc.)
|
||||||
|
- Runtime-agnostic, runs anywhere! (Vercel Edge Functions, Node.js, Serverless, etc.)
|
||||||
|
|
||||||
|
### Own your data
|
||||||
|
|
||||||
|
Auth.js can be used with or without a database.
|
||||||
|
|
||||||
|
- An open-source solution that allows you to keep control of your data
|
||||||
|
- Built-in support for [MySQL, MariaDB, Postgres, Microsoft SQL Server, MongoDB, SQLite, etc.](https://adapters.authjs.dev)
|
||||||
|
- Works great with databases from popular hosting providers
|
||||||
|
|
||||||
|
### Secure by default
|
||||||
|
|
||||||
|
- Promotes the use of passwordless sign-in mechanisms
|
||||||
|
- Designed to be secure by default and encourage best practices for safeguarding user data
|
||||||
|
- Uses Cross-Site Request Forgery (CSRF) Tokens on POST routes (sign in, sign out)
|
||||||
|
- Default cookie policy aims for the most restrictive policy appropriate for each cookie
|
||||||
|
- When JSON Web Tokens are used, they are encrypted by default (JWE) with A256GCM
|
||||||
|
- Features tab/window syncing and session polling to support short-lived sessions
|
||||||
|
- Attempts to implement the latest guidance published by [Open Web Application Security Project](https://owasp.org)
|
||||||
|
|
||||||
|
Advanced configuration allows you to define your routines to handle controlling what accounts are allowed to sign in, for encoding and decoding JSON Web Tokens and to set custom cookie security policies and session properties, so you can control who can sign in and how often sessions have to be re-validated.
|
||||||
|
|
||||||
|
### TypeScript
|
||||||
|
|
||||||
|
Auth.js libraries are written with type safety in mind. [Check out the docs](https://authjs.dev/getting-started/typescript) for more information.
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
If you think you have found a vulnerability (or are not sure) in Auth.js or any of the related packages (i.e. Adapters), we ask you to read our [Security Policy](https://authjs.dev/security) to reach out responsibly. Please do not open Pull Requests/Issues/Discussions before consulting with us.
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
|
||||||
|
[Auth.js is made possible thanks to all of its contributors.](https://authjs.dev/contributors)
|
||||||
|
|
||||||
|
<a href="https://github.com/nextauthjs/next-auth/graphs/contributors">
|
||||||
|
<img width="500px" src="https://contrib.rocks/image?repo=nextauthjs/next-auth" />
|
||||||
|
</a>
|
||||||
|
<div>
|
||||||
|
<a href="https://vercel.com?utm_source=nextauthjs&utm_campaign=oss"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
### Support
|
||||||
|
|
||||||
|
We have an [OpenCollective](https://opencollective.com/nextauth) for individuals and companies looking to contribute financially to the project!
|
||||||
|
|
||||||
|
<!--sponsors start-->
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td align="center" valign="top">
|
||||||
|
<a href="https://vercel.com" target="_blank">
|
||||||
|
<img width="128px" src="https://avatars.githubusercontent.com/u/14985020?v=4" alt="Vercel Logo" />
|
||||||
|
</a><br />
|
||||||
|
<div>Vercel</div><br />
|
||||||
|
<sub>🥉 Bronze Financial Sponsor <br /> ☁️ Infrastructure Support</sub>
|
||||||
|
</td>
|
||||||
|
<td align="center" valign="top">
|
||||||
|
<a href="https://prisma.io" target="_blank">
|
||||||
|
<img width="128px" src="https://avatars.githubusercontent.com/u/17219288?v=4" alt="Prisma Logo" />
|
||||||
|
</a><br />
|
||||||
|
<div>Prisma</div><br />
|
||||||
|
<sub>🥉 Bronze Financial Sponsor</sub>
|
||||||
|
</td>
|
||||||
|
<td align="center" valign="top">
|
||||||
|
<a href="https://clerk.com" target="_blank">
|
||||||
|
<img width="128px" src="https://avatars.githubusercontent.com/u/49538330?s=200&v=4" alt="Clerk Logo" />
|
||||||
|
</a><br />
|
||||||
|
<div>Clerk</div><br />
|
||||||
|
<sub>🥉 Bronze Financial Sponsor</sub>
|
||||||
|
</td>
|
||||||
|
<td align="center" valign="top">
|
||||||
|
<a href="https://lowdefy.com" target="_blank">
|
||||||
|
<img width="128px" src="https://avatars.githubusercontent.com/u/47087496?s=200&v=4" alt="Lowdefy Logo" />
|
||||||
|
</a><br />
|
||||||
|
<div>Lowdefy</div><br />
|
||||||
|
<sub>🥉 Bronze Financial Sponsor</sub>
|
||||||
|
</td>
|
||||||
|
<td align="center" valign="top">
|
||||||
|
<a href="https://workos.com" target="_blank">
|
||||||
|
<img width="128px" src="https://avatars.githubusercontent.com/u/47638084?s=200&v=4" alt="WorkOS Logo" />
|
||||||
|
</a><br />
|
||||||
|
<div>WorkOS</div><br />
|
||||||
|
<sub>🥉 Bronze Financial Sponsor</sub>
|
||||||
|
</td>
|
||||||
|
<td align="center" valign="top">
|
||||||
|
<a href="https://www.descope.com" target="_blank">
|
||||||
|
<img width="128px" src="https://avatars.githubusercontent.com/u/97479186?v=4" alt="Descope Logo" />
|
||||||
|
</a><br />
|
||||||
|
<div>Descope</div><br />
|
||||||
|
<sub>🥉 Bronze Financial Sponsor</sub>
|
||||||
|
</td>
|
||||||
|
<td align="center" valign="top">
|
||||||
|
<a href="https://checklyhq.com" target="_blank">
|
||||||
|
<img width="128px" src="https://avatars.githubusercontent.com/u/25982255?v=4" alt="Checkly Logo" />
|
||||||
|
</a><br />
|
||||||
|
<div>Checkly</div><br />
|
||||||
|
<sub>☁️ Infrastructure Support</sub>
|
||||||
|
</td>
|
||||||
|
<td align="center" valign="top">
|
||||||
|
<a href="https://superblog.ai/" target="_blank">
|
||||||
|
<img width="128px" src="https://d33wubrfki0l68.cloudfront.net/cdc4a3833bd878933fcc131655878dbf226ac1c5/10cd6/images/logo_bolt_small.png" alt="superblog Logo" />
|
||||||
|
</a><br />
|
||||||
|
<div>superblog</div><br />
|
||||||
|
<sub>☁️ Infrastructure Support</sub>
|
||||||
|
</td>
|
||||||
|
</tr><tr></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br />
|
||||||
|
<!--sponsors end-->
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
We're open to all community contributions! If you'd like to contribute in any way, please first read
|
||||||
|
our [Contributing Guide](https://github.com/nextauthjs/.github/blob/main/CONTRIBUTING.md).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
ISC
|
||||||
@@ -13,6 +13,9 @@ AUTH0_ID=
|
|||||||
AUTH0_SECRET=
|
AUTH0_SECRET=
|
||||||
AUTH0_ISSUER=
|
AUTH0_ISSUER=
|
||||||
|
|
||||||
|
DESCOPE_ID=
|
||||||
|
DESCOPE_SECRET=
|
||||||
|
|
||||||
KEYCLOAK_ID=
|
KEYCLOAK_ID=
|
||||||
KEYCLOAK_SECRET=
|
KEYCLOAK_SECRET=
|
||||||
KEYCLOAK_ISSUER=
|
KEYCLOAK_ISSUER=
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"typescript.tsdk": "../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/lib",
|
"typescript.tsdk": "../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/lib",
|
||||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
"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:
|
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
|
[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)
|
||||||
14
apps/dev/nextjs-v4/app/api/auth/[...nextauth]/route.ts
Normal file
14
apps/dev/nextjs-v4/app/api/auth/[...nextauth]/route.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import NextAuth, { type NextAuthOptions } from "next-auth"
|
||||||
|
import GitHub from "next-auth/providers/github"
|
||||||
|
|
||||||
|
export const authOptions: NextAuthOptions = {
|
||||||
|
providers: [
|
||||||
|
GitHub({
|
||||||
|
clientId: process.env.GITHUB_ID,
|
||||||
|
clientSecret: process.env.GITHUB_SECRET,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
const handler = NextAuth(authOptions)
|
||||||
|
export { handler as GET, handler as POST }
|
||||||
6
apps/dev/nextjs-v4/app/server-component/page.tsx
Normal file
6
apps/dev/nextjs-v4/app/server-component/page.tsx
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { getServerSession } from "next-auth/next"
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
const session = await getServerSession()
|
||||||
|
return <pre>{JSON.stringify(session, null, 2)}</pre>
|
||||||
|
}
|
||||||
28
apps/dev/nextjs-v4/components/footer.js
Normal file
28
apps/dev/nextjs-v4/components/footer.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import Link from "next/link"
|
||||||
|
import styles from "./footer.module.css"
|
||||||
|
import packageJSON from "package.json"
|
||||||
|
|
||||||
|
export default function Footer() {
|
||||||
|
return (
|
||||||
|
<footer className={styles.footer}>
|
||||||
|
<hr />
|
||||||
|
<ul className={styles.navItems}>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<a href="https://next-auth.js.org">Documentation</a>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<a href="https://www.npmjs.com/package/next-auth">NPM</a>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<a href="https://github.com/nextauthjs/next-auth-example">GitHub</a>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/policy">Policy</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<em>{packageJSON.version}</em>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</footer>
|
||||||
|
)
|
||||||
|
}
|
||||||
14
apps/dev/nextjs-v4/components/footer.module.css
Normal file
14
apps/dev/nextjs-v4/components/footer.module.css
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
.footer {
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navItems {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navItem {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
92
apps/dev/nextjs-v4/components/header.module.css
Normal file
92
apps/dev/nextjs-v4/components/header.module.css
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/* Set min-height to avoid page reflow while session loading */
|
||||||
|
.signedInStatus {
|
||||||
|
display: block;
|
||||||
|
min-height: 4rem;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading,
|
||||||
|
.loaded {
|
||||||
|
position: relative;
|
||||||
|
top: 0;
|
||||||
|
opacity: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 0 0 .6rem .6rem;
|
||||||
|
padding: .6rem 1rem;
|
||||||
|
margin: 0;
|
||||||
|
background-color: rgba(0,0,0,.05);
|
||||||
|
transition: all 0.2s ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
top: -2rem;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signedInText,
|
||||||
|
.notSignedInText {
|
||||||
|
position: absolute;
|
||||||
|
padding-top: .8rem;
|
||||||
|
left: 1rem;
|
||||||
|
right: 6.5rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
display: inherit;
|
||||||
|
z-index: 1;
|
||||||
|
line-height: 1.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signedInText {
|
||||||
|
padding-top: 0rem;
|
||||||
|
left: 4.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
border-radius: 2rem;
|
||||||
|
float: left;
|
||||||
|
height: 2.8rem;
|
||||||
|
width: 2.8rem;
|
||||||
|
background-color: white;
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button,
|
||||||
|
.buttonPrimary {
|
||||||
|
float: right;
|
||||||
|
margin-right: -.4rem;
|
||||||
|
font-weight: 500;
|
||||||
|
border-radius: .3rem;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 1.4rem;
|
||||||
|
padding: .7rem .8rem;
|
||||||
|
position: relative;
|
||||||
|
z-index: 10;
|
||||||
|
background-color: transparent;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttonPrimary {
|
||||||
|
background-color: #346df1;
|
||||||
|
border-color: #346df1;
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: .7rem 1.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttonPrimary:hover {
|
||||||
|
box-shadow: inset 0 0 5rem rgba(0,0,0,0.2)
|
||||||
|
}
|
||||||
|
|
||||||
|
.navItems {
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navItem {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
14
apps/dev/nextjs-v4/components/layout.js
Normal file
14
apps/dev/nextjs-v4/components/layout.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import Header from 'components/header'
|
||||||
|
import Footer from 'components/footer'
|
||||||
|
|
||||||
|
export default function Layout ({ children }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Header />
|
||||||
|
<main>
|
||||||
|
{children}
|
||||||
|
</main>
|
||||||
|
<Footer />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
|
/// <reference types="next/navigation-types/compat/navigation" />
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "next-auth-app",
|
"name": "next-auth-app-v4",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "NextAuth.js Developer app",
|
"description": "NextAuth.js Developer app",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -rf .next",
|
"clean": "rm -rf .next",
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
"lint": "next lint",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"email": "fake-smtp-server",
|
"email": "fake-smtp-server",
|
||||||
@@ -13,23 +14,22 @@
|
|||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next-auth/fauna-adapter": "workspace:*",
|
"@auth/fauna-adapter": "workspace:*",
|
||||||
"@next-auth/prisma-adapter": "workspace:*",
|
"@auth/prisma-adapter": "workspace:*",
|
||||||
"@next-auth/supabase-adapter": "workspace:*",
|
"@auth/supabase-adapter": "workspace:*",
|
||||||
"@next-auth/typeorm-legacy-adapter": "workspace:*",
|
"@auth/typeorm-adapter": "workspace:*",
|
||||||
"@prisma/client": "^3",
|
"@prisma/client": "^3",
|
||||||
"@supabase/supabase-js": "^2.0.5",
|
"@supabase/supabase-js": "^2.0.5",
|
||||||
"faunadb": "^4",
|
"faunadb": "^4",
|
||||||
"next": "13.0.6",
|
"next": "13.3.0",
|
||||||
"next-auth": "workspace:*",
|
"next-auth": "workspace:*",
|
||||||
"@auth/core": "workspace:*",
|
|
||||||
"nodemailer": "^6",
|
"nodemailer": "^6",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
"react-dom": "^18"
|
"react-dom": "^18"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jsonwebtoken": "^8.5.5",
|
"@types/jsonwebtoken": "^8.5.5",
|
||||||
"@types/react": "^18.0.15",
|
"@types/react": "^18.0.37",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"fake-smtp-server": "^0.8.0",
|
"fake-smtp-server": "^0.8.0",
|
||||||
"pg": "^8.7.3",
|
"pg": "^8.7.3",
|
||||||
17
apps/dev/nextjs-v4/pages/api-example.js
Normal file
17
apps/dev/nextjs-v4/pages/api-example.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import Layout from '../components/layout'
|
||||||
|
|
||||||
|
export default function Page () {
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>API Example</h1>
|
||||||
|
<p>The examples below show responses from the example API endpoints.</p>
|
||||||
|
<p><em>You must be signed in to see responses.</em></p>
|
||||||
|
<h2>Session</h2>
|
||||||
|
<p>/api/examples/session</p>
|
||||||
|
<iframe src='/api/examples/session' />
|
||||||
|
<h2>JSON Web Token</h2>
|
||||||
|
<p>/api/examples/jwt</p>
|
||||||
|
<iframe src='/api/examples/jwt' />
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
217
apps/dev/nextjs-v4/pages/api/auth-old/[...nextauth].ts
Normal file
217
apps/dev/nextjs-v4/pages/api/auth-old/[...nextauth].ts
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
import NextAuth, { NextAuthOptions } from "next-auth"
|
||||||
|
|
||||||
|
// Providers
|
||||||
|
import Apple from "next-auth/providers/apple"
|
||||||
|
import Auth0 from "next-auth/providers/auth0"
|
||||||
|
import AzureAD from "next-auth/providers/azure-ad"
|
||||||
|
import AzureB2C from "next-auth/providers/azure-ad-b2c"
|
||||||
|
import BoxyHQSAML from "next-auth/providers/boxyhq-saml"
|
||||||
|
// import Cognito from "next-auth/providers/cognito"
|
||||||
|
import Credentials from "next-auth/providers/credentials"
|
||||||
|
import Discord from "next-auth/providers/discord"
|
||||||
|
import DuendeIDS6 from "next-auth/providers/duende-identity-server6"
|
||||||
|
// import Email from "next-auth/providers/email"
|
||||||
|
import Facebook from "next-auth/providers/facebook"
|
||||||
|
import Foursquare from "next-auth/providers/foursquare"
|
||||||
|
import Freshbooks from "next-auth/providers/freshbooks"
|
||||||
|
import GitHub from "next-auth/providers/github"
|
||||||
|
import Gitlab from "next-auth/providers/gitlab"
|
||||||
|
import Google from "next-auth/providers/google"
|
||||||
|
// import IDS4 from "next-auth/providers/identity-server4"
|
||||||
|
import Instagram from "next-auth/providers/instagram"
|
||||||
|
// import Keycloak from "next-auth/providers/keycloak"
|
||||||
|
import Line from "next-auth/providers/line"
|
||||||
|
import LinkedIn from "next-auth/providers/linkedin"
|
||||||
|
import Mailchimp from "next-auth/providers/mailchimp"
|
||||||
|
// import Okta from "next-auth/providers/okta"
|
||||||
|
import Osu from "next-auth/providers/osu"
|
||||||
|
import Patreon from "next-auth/providers/patreon"
|
||||||
|
import Slack from "next-auth/providers/slack"
|
||||||
|
import Spotify from "next-auth/providers/spotify"
|
||||||
|
import Trakt from "next-auth/providers/trakt"
|
||||||
|
import Twitch from "next-auth/providers/twitch"
|
||||||
|
import Twitter from "next-auth/providers/twitter"
|
||||||
|
import Vk from "next-auth/providers/vk"
|
||||||
|
import Wikimedia from "next-auth/providers/wikimedia"
|
||||||
|
import WorkOS from "next-auth/providers/workos"
|
||||||
|
|
||||||
|
// // Prisma
|
||||||
|
// import { PrismaClient } from "@prisma/client"
|
||||||
|
// import { PrismaAdapter } from "@auth/prisma-adapter"
|
||||||
|
// const client = globalThis.prisma || new PrismaClient()
|
||||||
|
// if (process.env.NODE_ENV !== "production") globalThis.prisma = client
|
||||||
|
// const adapter = PrismaAdapter(client)
|
||||||
|
|
||||||
|
// // Fauna
|
||||||
|
// import { Client as FaunaClient } from "faunadb"
|
||||||
|
// import { FaunaAdapter } from "@auth/fauna-adapter"
|
||||||
|
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
|
||||||
|
// const client = globalThis.fauna || new FaunaClient(opts)
|
||||||
|
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
|
||||||
|
// const adapter = FaunaAdapter(client)
|
||||||
|
|
||||||
|
// // TypeORM
|
||||||
|
// import { TypeORMAdapter } from "@auth/typeorm-adapter"
|
||||||
|
// const adapter = TypeORMAdapter({
|
||||||
|
// type: "sqlite",
|
||||||
|
// name: "next-auth-test-memory",
|
||||||
|
// database: "./typeorm/dev.db",
|
||||||
|
// synchronize: true,
|
||||||
|
// })
|
||||||
|
|
||||||
|
// // Supabase
|
||||||
|
// import { SupabaseAdapter } from "@auth/supabase-adapter"
|
||||||
|
// const adapter = SupabaseAdapter({
|
||||||
|
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||||
|
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
||||||
|
// })
|
||||||
|
|
||||||
|
export const authOptions: NextAuthOptions = {
|
||||||
|
// adapter,
|
||||||
|
// debug: process.env.NODE_ENV !== "production",
|
||||||
|
theme: {
|
||||||
|
logo: "https://next-auth.js.org/img/logo/logo-sm.png",
|
||||||
|
brandColor: "#1786fb",
|
||||||
|
},
|
||||||
|
providers: [
|
||||||
|
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: "",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
Apple({
|
||||||
|
clientId: process.env.APPLE_ID,
|
||||||
|
clientSecret: process.env.APPLE_SECRET,
|
||||||
|
}),
|
||||||
|
Auth0({
|
||||||
|
clientId: process.env.AUTH0_ID,
|
||||||
|
clientSecret: process.env.AUTH0_SECRET,
|
||||||
|
issuer: process.env.AUTH0_ISSUER,
|
||||||
|
}),
|
||||||
|
AzureAD({
|
||||||
|
clientId: process.env.AZURE_AD_CLIENT_ID,
|
||||||
|
clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
|
||||||
|
tenantId: process.env.AZURE_AD_TENANT_ID,
|
||||||
|
}),
|
||||||
|
AzureB2C({
|
||||||
|
clientId: process.env.AZURE_B2C_ID,
|
||||||
|
clientSecret: process.env.AZURE_B2C_SECRET,
|
||||||
|
issuer: process.env.AZURE_B2C_ISSUER,
|
||||||
|
}),
|
||||||
|
BoxyHQSAML({
|
||||||
|
issuer: "https://jackson-demo.boxyhq.com",
|
||||||
|
clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com",
|
||||||
|
clientSecret: "dummy",
|
||||||
|
}),
|
||||||
|
// Cognito({ clientId: process.env.COGNITO_ID, clientSecret: process.env.COGNITO_SECRET, issuer: process.env.COGNITO_ISSUER }),
|
||||||
|
Discord({
|
||||||
|
clientId: process.env.DISCORD_ID,
|
||||||
|
clientSecret: process.env.DISCORD_SECRET,
|
||||||
|
}),
|
||||||
|
DuendeIDS6({
|
||||||
|
clientId: "interactive.confidential",
|
||||||
|
clientSecret: "secret",
|
||||||
|
issuer: "https://demo.duendesoftware.com",
|
||||||
|
}),
|
||||||
|
Facebook({
|
||||||
|
clientId: process.env.FACEBOOK_ID,
|
||||||
|
clientSecret: process.env.FACEBOOK_SECRET,
|
||||||
|
}),
|
||||||
|
Foursquare({
|
||||||
|
clientId: process.env.FOURSQUARE_ID,
|
||||||
|
clientSecret: process.env.FOURSQUARE_SECRET,
|
||||||
|
}),
|
||||||
|
Freshbooks({
|
||||||
|
clientId: process.env.FRESHBOOKS_ID,
|
||||||
|
clientSecret: process.env.FRESHBOOKS_SECRET,
|
||||||
|
}),
|
||||||
|
GitHub({
|
||||||
|
clientId: process.env.GITHUB_ID,
|
||||||
|
clientSecret: process.env.GITHUB_SECRET,
|
||||||
|
}),
|
||||||
|
Gitlab({
|
||||||
|
clientId: process.env.GITLAB_ID,
|
||||||
|
clientSecret: process.env.GITLAB_SECRET,
|
||||||
|
}),
|
||||||
|
Google({
|
||||||
|
clientId: process.env.GOOGLE_ID,
|
||||||
|
clientSecret: process.env.GOOGLE_SECRET,
|
||||||
|
}),
|
||||||
|
// IDS4({ clientId: process.env.IDS4_ID, clientSecret: process.env.IDS4_SECRET, issuer: process.env.IDS4_ISSUER }),
|
||||||
|
Instagram({
|
||||||
|
clientId: process.env.INSTAGRAM_ID,
|
||||||
|
clientSecret: process.env.INSTAGRAM_SECRET,
|
||||||
|
}),
|
||||||
|
// Keycloak({ clientId: process.env.KEYCLOAK_ID, clientSecret: process.env.KEYCLOAK_SECRET, issuer: process.env.KEYCLOAK_ISSUER }),
|
||||||
|
Line({
|
||||||
|
clientId: process.env.LINE_ID,
|
||||||
|
clientSecret: process.env.LINE_SECRET,
|
||||||
|
}),
|
||||||
|
LinkedIn({
|
||||||
|
clientId: process.env.LINKEDIN_ID,
|
||||||
|
clientSecret: process.env.LINKEDIN_SECRET,
|
||||||
|
}),
|
||||||
|
Mailchimp({
|
||||||
|
clientId: process.env.MAILCHIMP_ID,
|
||||||
|
clientSecret: process.env.MAILCHIMP_SECRET,
|
||||||
|
}),
|
||||||
|
// Okta({ clientId: process.env.OKTA_ID, clientSecret: process.env.OKTA_SECRET, issuer: process.env.OKTA_ISSUER }),
|
||||||
|
Osu({
|
||||||
|
clientId: process.env.OSU_CLIENT_ID,
|
||||||
|
clientSecret: process.env.OSU_CLIENT_SECRET,
|
||||||
|
}),
|
||||||
|
Patreon({
|
||||||
|
clientId: process.env.PATREON_ID,
|
||||||
|
clientSecret: process.env.PATREON_SECRET,
|
||||||
|
}),
|
||||||
|
Slack({
|
||||||
|
clientId: process.env.SLACK_ID,
|
||||||
|
clientSecret: process.env.SLACK_SECRET,
|
||||||
|
}),
|
||||||
|
Spotify({
|
||||||
|
clientId: process.env.SPOTIFY_ID,
|
||||||
|
clientSecret: process.env.SPOTIFY_SECRET,
|
||||||
|
}),
|
||||||
|
Trakt({
|
||||||
|
clientId: process.env.TRAKT_ID,
|
||||||
|
clientSecret: process.env.TRAKT_SECRET,
|
||||||
|
}),
|
||||||
|
Twitch({
|
||||||
|
clientId: process.env.TWITCH_ID,
|
||||||
|
clientSecret: process.env.TWITCH_SECRET,
|
||||||
|
}),
|
||||||
|
Twitter({
|
||||||
|
clientId: process.env.TWITTER_ID,
|
||||||
|
clientSecret: process.env.TWITTER_SECRET,
|
||||||
|
}),
|
||||||
|
// TwitterLegacy({ clientId: process.env.TWITTER_LEGACY_ID, clientSecret: process.env.TWITTER_LEGACY_SECRET }),
|
||||||
|
Vk({ clientId: process.env.VK_ID, clientSecret: process.env.VK_SECRET }),
|
||||||
|
Wikimedia({
|
||||||
|
clientId: process.env.WIKIMEDIA_ID,
|
||||||
|
clientSecret: process.env.WIKIMEDIA_SECRET,
|
||||||
|
}),
|
||||||
|
WorkOS({
|
||||||
|
clientId: process.env.WORKOS_ID,
|
||||||
|
clientSecret: process.env.WORKOS_SECRET,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
if (authOptions.adapter) {
|
||||||
|
// TODO:
|
||||||
|
// authOptions.providers.unshift(
|
||||||
|
// // NOTE: You can start a fake e-mail server with `pnpm email`
|
||||||
|
// // and then go to `http://localhost:1080` in the browser
|
||||||
|
// Email({ server: "smtp://127.0.0.1:1025?tls.rejectUnauthorized=false" })
|
||||||
|
// )
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NextAuth(authOptions)
|
||||||
19
apps/dev/nextjs-v4/pages/api/examples/protected.js
Normal file
19
apps/dev/nextjs-v4/pages/api/examples/protected.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// This is an example of to protect an API route
|
||||||
|
import { getServerSession } from "next-auth/next"
|
||||||
|
import { authOptions } from "../auth/[...nextauth]"
|
||||||
|
|
||||||
|
export default async (req, res) => {
|
||||||
|
const session = await getServerSession(req, res, authOptions)
|
||||||
|
|
||||||
|
if (session) {
|
||||||
|
res.send({
|
||||||
|
content:
|
||||||
|
"This is protected content. You can access this content because you are signed in.",
|
||||||
|
session,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
res.send({
|
||||||
|
error: "You must be sign in to view the protected content on this page.",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
8
apps/dev/nextjs-v4/pages/api/examples/session.js
Normal file
8
apps/dev/nextjs-v4/pages/api/examples/session.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// This is an example of how to access a session from an API route
|
||||||
|
import { getServerSession } from "next-auth/next"
|
||||||
|
import { authOptions } from "../auth/[...nextauth]"
|
||||||
|
|
||||||
|
export default async (req, res) => {
|
||||||
|
const session = await getServerSession(req, res, authOptions)
|
||||||
|
res.json(session)
|
||||||
|
}
|
||||||
30
apps/dev/nextjs-v4/pages/api/examples/supabase-rls.js
Normal file
30
apps/dev/nextjs-v4/pages/api/examples/supabase-rls.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// This is an example of how to query data from Supabase with RLS.
|
||||||
|
// Learn more about Row Levele Security (RLS): https://supabase.com/docs/guides/auth/row-level-security
|
||||||
|
import { getServerSession } from "next-auth/next"
|
||||||
|
import { authOptions } from "../auth/[...nextauth]"
|
||||||
|
import { createClient } from "@supabase/supabase-js"
|
||||||
|
|
||||||
|
export default async (req, res) => {
|
||||||
|
const session = await getServerSession(req, res, authOptions)
|
||||||
|
|
||||||
|
if (!session)
|
||||||
|
return res.send(JSON.stringify({ error: "No session!" }, null, 2))
|
||||||
|
|
||||||
|
const { supabaseAccessToken } = session
|
||||||
|
|
||||||
|
const supabase = createClient(
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
|
||||||
|
{
|
||||||
|
global: {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${supabaseAccessToken}`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
// Now you can query with RLS enabled.
|
||||||
|
const { data, error } = await supabase.from("users").select("*")
|
||||||
|
|
||||||
|
res.send(JSON.stringify({ supabaseAccessToken, data, error }, null, 2))
|
||||||
|
}
|
||||||
22
apps/dev/nextjs-v4/pages/client.js
Normal file
22
apps/dev/nextjs-v4/pages/client.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import Layout from '../components/layout'
|
||||||
|
|
||||||
|
export default function Page () {
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Client Side Rendering</h1>
|
||||||
|
<p>
|
||||||
|
This page uses the <strong>useSession()</strong> React Hook in the <strong></Header></strong> component.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The <strong>useSession()</strong> React Hook easy to use and allows pages to render very quickly.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The advantage of this approach is that session state is shared between pages by using the <strong>Provider</strong> in <strong>_app.js</strong> so
|
||||||
|
that navigation between pages using <strong>useSession()</strong> is very fast.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The disadvantage of <strong>useSession()</strong> is that it requires client side JavaScript.
|
||||||
|
</p>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
12
apps/dev/nextjs-v4/pages/index.js
Normal file
12
apps/dev/nextjs-v4/pages/index.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import Layout from 'components/layout'
|
||||||
|
|
||||||
|
export default function Page () {
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>NextAuth.js Example</h1>
|
||||||
|
<p>
|
||||||
|
This is an example site to demonstrate how to use <a href='https://next-auth.js.org'>NextAuth.js</a> for authentication.
|
||||||
|
</p>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
30
apps/dev/nextjs-v4/pages/policy.js
Normal file
30
apps/dev/nextjs-v4/pages/policy.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import Layout from '../components/layout'
|
||||||
|
|
||||||
|
export default function Page () {
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<p>
|
||||||
|
This is an example site to demonstrate how to use <a href='https://next-auth.js.org'>NextAuth.js</a> for authentication.
|
||||||
|
</p>
|
||||||
|
<h2>Terms of Service</h2>
|
||||||
|
<p>
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
</p>
|
||||||
|
<h2>Privacy Policy</h2>
|
||||||
|
<p>
|
||||||
|
This site uses JSON Web Tokens and an in-memory database which resets every ~2 hours.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Data provided to this site is exclusively used to support signing in
|
||||||
|
and is not passed to any third party services, other than via SMTP or OAuth for the
|
||||||
|
purposes of authentication.
|
||||||
|
</p>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
48
apps/dev/nextjs-v4/pages/protected-ssr.js
Normal file
48
apps/dev/nextjs-v4/pages/protected-ssr.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
// This is an example of how to protect content using server rendering
|
||||||
|
import { getServerSession } from "next-auth/next"
|
||||||
|
import { authOptions } from "./api/auth/[...nextauth]"
|
||||||
|
import Layout from "../components/layout"
|
||||||
|
import AccessDenied from "../components/access-denied"
|
||||||
|
|
||||||
|
export default function Page({ content, session }) {
|
||||||
|
// If no session exists, display access denied message
|
||||||
|
if (!session) {
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<AccessDenied />
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// If session exists, display content
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Protected Page</h1>
|
||||||
|
<p>
|
||||||
|
<strong>{content}</strong>
|
||||||
|
</p>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps(context) {
|
||||||
|
const session = await getServerSession(context.req, context.res, authOptions)
|
||||||
|
let content = null
|
||||||
|
|
||||||
|
if (session) {
|
||||||
|
const hostname = process.env.NEXTAUTH_URL || "http://localhost:3000"
|
||||||
|
const options = { headers: { cookie: context.req.headers.cookie } }
|
||||||
|
const res = await fetch(`${hostname}/api/examples/protected`, options)
|
||||||
|
const json = await res.json()
|
||||||
|
if (json.content) {
|
||||||
|
content = json.content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
session,
|
||||||
|
content,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
46
apps/dev/nextjs-v4/pages/server.js
Normal file
46
apps/dev/nextjs-v4/pages/server.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import { getServerSession } from "next-auth/next"
|
||||||
|
import Layout from "../components/layout"
|
||||||
|
import { authOptions } from "./api/auth/[...nextauth]"
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
// As this page uses Server Side Rendering, the `session` will be already
|
||||||
|
// populated on render without needing to go through a loading stage.
|
||||||
|
// This is possible because of the shared context configured in `_app.js` that
|
||||||
|
// is used by `useSession()`.
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Server Side Rendering</h1>
|
||||||
|
<p>
|
||||||
|
This page uses the <strong>getServerSession()</strong> method in{" "}
|
||||||
|
<strong>getServerSideProps()</strong>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Using <strong>getServerSession()</strong> in{" "}
|
||||||
|
<strong>getServerSideProps()</strong> is currently the recommended
|
||||||
|
approach, although the API may still change, if you need to support
|
||||||
|
Server Side Rendering with authentication.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Using <strong>getSession()</strong> is still recommended on the client.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The advantage of Server Side Rendering is this page does not require
|
||||||
|
client side JavaScript.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The disadvantage of Server Side Rendering is that this page is slower to
|
||||||
|
render.
|
||||||
|
</p>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export the `session` prop to use sessions with Server Side Rendering
|
||||||
|
export async function getServerSideProps(context) {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
session: await getServerSession(context.req, context.res, authOptions),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
32
apps/dev/nextjs-v4/pages/styles.css
Normal file
32
apps/dev/nextjs-v4/pages/styles.css
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
body {
|
||||||
|
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
||||||
|
"Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
|
||||||
|
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
padding: 0 1rem 1rem 1rem;
|
||||||
|
max-width: 680px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background: #fff;
|
||||||
|
color: var(--color-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
li,
|
||||||
|
p {
|
||||||
|
line-height: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
background: #ccc;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
height: 10rem;
|
||||||
|
width: 100%;
|
||||||
|
border-radius: .5rem;
|
||||||
|
filter: invert(1);
|
||||||
|
}
|
||||||
49
apps/dev/nextjs-v4/pages/supabase-client-rls.js
Normal file
49
apps/dev/nextjs-v4/pages/supabase-client-rls.js
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import Layout from "../components/layout"
|
||||||
|
import { useState, useEffect } from "react"
|
||||||
|
import { useSession } from "next-auth/react"
|
||||||
|
import { createClient } from "@supabase/supabase-js"
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
const { data: session } = useSession()
|
||||||
|
const [data, setData] = useState(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (session) {
|
||||||
|
console.log(session)
|
||||||
|
// User is logged in, let's fetch their data.
|
||||||
|
const { supabaseAccessToken } = session
|
||||||
|
const supabase = createClient(
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
|
||||||
|
{
|
||||||
|
global: {
|
||||||
|
headers: { Authorization: `Bearer ${supabaseAccessToken}` },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
// Fetch data with RLS enabled.
|
||||||
|
supabase
|
||||||
|
.from("users")
|
||||||
|
.select("*")
|
||||||
|
.then(({ data }) => setData(data))
|
||||||
|
}
|
||||||
|
}, [session])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Fetch Data from Supabase with RLS</h1>
|
||||||
|
<h2>Client-side data fetching with RLS:</h2>
|
||||||
|
<pre>{JSON.stringify(data, null, 2)}</pre>
|
||||||
|
<h2>API Example</h2>
|
||||||
|
<p>
|
||||||
|
You can also use Supabase in API routes. See the code in the
|
||||||
|
`/pages/api/examples/supabase-rls.js` file.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<em>You must be signed in to see responses.</em>
|
||||||
|
</p>
|
||||||
|
<p>/api/examples/supabase-rls</p>
|
||||||
|
<iframe src="/api/examples/supabase-rls" />
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
64
apps/dev/nextjs-v4/pages/supabase-ssr.js
Normal file
64
apps/dev/nextjs-v4/pages/supabase-ssr.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
// This is an example of how to protect content using server rendering
|
||||||
|
// and fetching data from Supabase with RLS enabled.
|
||||||
|
import { getServerSession } from "next-auth/next"
|
||||||
|
import { authOptions } from "./api/auth/[...nextauth]"
|
||||||
|
import { createClient } from "@supabase/supabase-js"
|
||||||
|
import Layout from "../components/layout"
|
||||||
|
import AccessDenied from "../components/access-denied"
|
||||||
|
|
||||||
|
export default function Page({ data, session }) {
|
||||||
|
// If no session exists, display access denied message
|
||||||
|
if (!session) {
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<AccessDenied />
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// If session exists, display content
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Protected Page</h1>
|
||||||
|
<p>Data fetched during SSR from Supabase with RSL enabled:</p>
|
||||||
|
<pre>{JSON.stringify(data, null, 2)}</pre>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps(context) {
|
||||||
|
const session = await getServerSession(context.req, context.res, authOptions)
|
||||||
|
|
||||||
|
if (!session)
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
session,
|
||||||
|
data: null,
|
||||||
|
error: "No session",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const { supabaseAccessToken } = session
|
||||||
|
|
||||||
|
const supabase = createClient(
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||||
|
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
|
||||||
|
{
|
||||||
|
global: {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${supabaseAccessToken}`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
// Now you can query with RLS enabled.
|
||||||
|
const { data, error } = await supabase.from("users").select("*")
|
||||||
|
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
session,
|
||||||
|
data,
|
||||||
|
error,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "Account" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"userId" TEXT NOT NULL,
|
||||||
|
"type" TEXT NOT NULL,
|
||||||
|
"provider" TEXT NOT NULL,
|
||||||
|
"providerAccountId" TEXT NOT NULL,
|
||||||
|
"refresh_token" TEXT,
|
||||||
|
"access_token" TEXT,
|
||||||
|
"expires_at" INTEGER,
|
||||||
|
"token_type" TEXT,
|
||||||
|
"scope" TEXT,
|
||||||
|
"id_token" TEXT,
|
||||||
|
"session_state" TEXT,
|
||||||
|
"oauth_token_secret" TEXT,
|
||||||
|
"oauth_token" TEXT,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" DATETIME NOT NULL,
|
||||||
|
CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "Session" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"sessionToken" TEXT NOT NULL,
|
||||||
|
"userId" TEXT NOT NULL,
|
||||||
|
"expires" DATETIME NOT NULL,
|
||||||
|
CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "User" (
|
||||||
|
"id" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"name" TEXT,
|
||||||
|
"email" TEXT,
|
||||||
|
"emailVerified" DATETIME,
|
||||||
|
"image" TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "VerificationToken" (
|
||||||
|
"identifier" TEXT NOT NULL,
|
||||||
|
"token" TEXT NOT NULL,
|
||||||
|
"expires" DATETIME NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");
|
||||||
3
apps/dev/nextjs-v4/prisma/migrations/migration_lock.toml
Normal file
3
apps/dev/nextjs-v4/prisma/migrations/migration_lock.toml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Please do not edit this file manually
|
||||||
|
# It should be added in your version-control system (i.e. Git)
|
||||||
|
provider = "sqlite"
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"esnext"
|
||||||
|
],
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": false,
|
"strict": false,
|
||||||
@@ -19,8 +23,17 @@
|
|||||||
{
|
{
|
||||||
"name": "next"
|
"name": "next"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"strictNullChecks": true
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
"include": [
|
||||||
"exclude": ["node_modules", "jest.config.js"]
|
"next-env.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
".next/types/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"jest.config.js"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
82
apps/dev/nextjs/.env.local.example
Normal file
82
apps/dev/nextjs/.env.local.example
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
# Rename file to .env.local (or .env) and populate values
|
||||||
|
# to be able to run the dev app
|
||||||
|
|
||||||
|
NEXTAUTH_URL=http://localhost:3000
|
||||||
|
|
||||||
|
# You can use `openssl rand -hex 32` or
|
||||||
|
# https://generate-secret.vercel.app/32 to generate a secret.
|
||||||
|
# Note: Changing a secret may invalidate existing sessions
|
||||||
|
# and/or verification tokens.
|
||||||
|
NEXTAUTH_SECRET=secret
|
||||||
|
|
||||||
|
ASGARDEO_CLIENT_ID=
|
||||||
|
ASGARDEO_CLIENT_SECRET=
|
||||||
|
ASGARDEO_ISSUER=
|
||||||
|
|
||||||
|
AUTH0_ID=
|
||||||
|
AUTH0_SECRET=
|
||||||
|
AUTH0_ISSUER=
|
||||||
|
|
||||||
|
# Beyond Identity Provider
|
||||||
|
BEYOND_IDENTITY_CLIENT_ID=
|
||||||
|
BEYOND_IDENTITY_CLIENT_SECRET=
|
||||||
|
BEYOND_IDENTITY_ISSUER=
|
||||||
|
|
||||||
|
DESCOPE_ID=
|
||||||
|
DESCOPE_SECRET=
|
||||||
|
|
||||||
|
GITHUB_ID=
|
||||||
|
GITHUB_SECRET=
|
||||||
|
|
||||||
|
NOTION_ID=
|
||||||
|
NOTION_SECRET=
|
||||||
|
NOTION_REDIRECT_URI=
|
||||||
|
|
||||||
|
IDS4_ID=
|
||||||
|
IDS4_SECRET=
|
||||||
|
IDS4_ISSUER=
|
||||||
|
|
||||||
|
KEYCLOAK_ID=
|
||||||
|
KEYCLOAK_SECRET=
|
||||||
|
KEYCLOAK_ISSUER=
|
||||||
|
|
||||||
|
LINE_ID=
|
||||||
|
LINE_SECRET=
|
||||||
|
|
||||||
|
TRAKT_ID=
|
||||||
|
TRAKT_SECRET=
|
||||||
|
|
||||||
|
TWITCH_ID=
|
||||||
|
TWITCH_SECRET=
|
||||||
|
|
||||||
|
TWITTER_ID=
|
||||||
|
TWITTER_SECRET=
|
||||||
|
|
||||||
|
WIKIMEDIA_ID=
|
||||||
|
WIKIMEDIA_SECRET=
|
||||||
|
|
||||||
|
# Yandex OAuth. new app -> https://oauth.yandex.com/client/new/id
|
||||||
|
YANDEX_ID=
|
||||||
|
YANDEX_SECRET=
|
||||||
|
|
||||||
|
# ClickUp OAuth. https://clickup.com/api/
|
||||||
|
CLICK_UP_ID=
|
||||||
|
CLICK_UP_SECRET=
|
||||||
|
|
||||||
|
# Example configuration for a Gmail account (will need SMTP enabled)
|
||||||
|
EMAIL_SERVER=smtps://user@gmail.com:password@smtp.gmail.com:465
|
||||||
|
EMAIL_FROM=user@gmail.com
|
||||||
|
|
||||||
|
# Note: If using with Prisma adapter, you need to use a `.env`
|
||||||
|
# file rather than a `.env.local` file to configure env vars.
|
||||||
|
# Postgres: DATABASE_URL=postgres://nextauth:password@127.0.0.1:5432/nextauth?synchronize=true
|
||||||
|
# MySQL: DATABASE_URL=mysql://nextauth:password@127.0.0.1:3306/nextauth?synchronize=true
|
||||||
|
# MongoDB: DATABASE_URL=mongodb://nextauth:password@127.0.0.1:27017/nextauth?synchronize=true
|
||||||
|
DATABASE_URL=
|
||||||
|
|
||||||
|
# Supabase Example Configuration
|
||||||
|
# Supabase Example Configuration
|
||||||
|
# NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321
|
||||||
|
# SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSJ9.vI9obAHOGyVVKa3pD--kJlyxp-Z2zV9UUMAhKpNLAcU
|
||||||
|
# SUPABASE_JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long
|
||||||
|
# NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs
|
||||||
5
apps/dev/nextjs/.gitignore
vendored
Normal file
5
apps/dev/nextjs/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
node_modules/
|
||||||
|
/test-results/
|
||||||
|
/playwright-report/
|
||||||
|
/playwright/.cache/
|
||||||
|
dbschema/edgeql-js
|
||||||
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
|
||||||
|
}
|
||||||
6
apps/dev/nextjs/README.md
Normal file
6
apps/dev/nextjs/README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# NextAuth.js Development App
|
||||||
|
|
||||||
|
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/.github/blob/main/CONTRIBUTING.md#setting-up-local-environment)
|
||||||
12
apps/dev/nextjs/app/layout.tsx
Normal file
12
apps/dev/nextjs/app/layout.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export default function RootLayout({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<html>
|
||||||
|
<head></head>
|
||||||
|
<body>{children}</body>
|
||||||
|
</html>
|
||||||
|
)
|
||||||
|
}
|
||||||
89
apps/dev/nextjs/components/header.js
Normal file
89
apps/dev/nextjs/components/header.js
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import Link from "next/link"
|
||||||
|
import { useSession } from "next-auth/react"
|
||||||
|
import styles from "./header.module.css"
|
||||||
|
|
||||||
|
// The approach used in this component shows how to built a sign in and sign out
|
||||||
|
// component that works on pages which support both client and server side
|
||||||
|
// rendering, and avoids any flash incorrect content on initial page load.
|
||||||
|
export default function Header() {
|
||||||
|
const { data: session, status } = useSession()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<header>
|
||||||
|
<noscript>
|
||||||
|
<style>{".nojs-show { opacity: 1; top: 0; }"}</style>
|
||||||
|
</noscript>
|
||||||
|
<div className={styles.signedInStatus}>
|
||||||
|
<p
|
||||||
|
className={`nojs-show ${
|
||||||
|
!session && status === "loading" ? styles.loading : styles.loaded
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{!session && (
|
||||||
|
<>
|
||||||
|
<span className={styles.notSignedInText}>
|
||||||
|
You are not signed in
|
||||||
|
</span>
|
||||||
|
<a href="/api/auth/signin" className={styles.buttonPrimary}>
|
||||||
|
Sign in
|
||||||
|
</a>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{session && (
|
||||||
|
<>
|
||||||
|
{session.user.image && (
|
||||||
|
<img src={session.user.image} className={styles.avatar} />
|
||||||
|
)}
|
||||||
|
<span className={styles.signedInText}>
|
||||||
|
<small>Signed in as</small>
|
||||||
|
<br />
|
||||||
|
<strong>{session.user.email} </strong>
|
||||||
|
{session.user.name ? `(${session.user.name})` : null}
|
||||||
|
</span>
|
||||||
|
<a href="/api/auth/signout" className={styles.button}>
|
||||||
|
Sign out
|
||||||
|
</a>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<nav>
|
||||||
|
<ul className={styles.navItems}>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/">Home</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/client">Client</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/server">Server</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/protected">Protected</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/protected-ssr">Protected(SSR)</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/api-example">API</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/credentials">Credentials</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/email">Email</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/middleware-protected">Middleware protected</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/supabase-client-rls">Supabase RLS</Link>
|
||||||
|
</li>
|
||||||
|
<li className={styles.navItem}>
|
||||||
|
<Link href="/supabase-ssr">Supabase RLS(SSR)</Link>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
)
|
||||||
|
}
|
||||||
71
apps/dev/nextjs/dbschema/default.esdl
Normal file
71
apps/dev/nextjs/dbschema/default.esdl
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
module default {
|
||||||
|
type User {
|
||||||
|
property name -> str;
|
||||||
|
required property email -> str {
|
||||||
|
constraint exclusive;
|
||||||
|
}
|
||||||
|
property emailVerified -> datetime;
|
||||||
|
property image -> str;
|
||||||
|
multi link accounts := .<user[is Account];
|
||||||
|
multi link sessions := .<user[is Session];
|
||||||
|
property createdAt -> datetime {
|
||||||
|
default := datetime_current();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
type Account {
|
||||||
|
required property userId := .user.id;
|
||||||
|
required property type -> str;
|
||||||
|
required property provider -> str;
|
||||||
|
required property providerAccountId -> str {
|
||||||
|
constraint exclusive;
|
||||||
|
};
|
||||||
|
property refresh_token -> str;
|
||||||
|
property access_token -> str;
|
||||||
|
property expires_at -> int64;
|
||||||
|
property token_type -> str;
|
||||||
|
property scope -> str;
|
||||||
|
property id_token -> str;
|
||||||
|
property session_state -> str;
|
||||||
|
required link user -> User {
|
||||||
|
on target delete delete source;
|
||||||
|
};
|
||||||
|
property createdAt -> datetime {
|
||||||
|
default := datetime_current();
|
||||||
|
};
|
||||||
|
|
||||||
|
constraint exclusive on ((.provider, .providerAccountId))
|
||||||
|
}
|
||||||
|
|
||||||
|
type Session {
|
||||||
|
required property sessionToken -> str {
|
||||||
|
constraint exclusive;
|
||||||
|
}
|
||||||
|
required property userId := .user.id;
|
||||||
|
required property expires -> datetime;
|
||||||
|
required link user -> User {
|
||||||
|
on target delete delete source;
|
||||||
|
};
|
||||||
|
property createdAt -> datetime {
|
||||||
|
default := datetime_current();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
type VerificationToken {
|
||||||
|
required property identifier -> str;
|
||||||
|
required property token -> str {
|
||||||
|
constraint exclusive;
|
||||||
|
}
|
||||||
|
required property expires -> datetime;
|
||||||
|
property createdAt -> datetime {
|
||||||
|
default := datetime_current();
|
||||||
|
};
|
||||||
|
|
||||||
|
constraint exclusive on ((.identifier, .token))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Disable the application of access policies within access policies
|
||||||
|
# themselves. This behavior will become the default in EdgeDB 3.0.
|
||||||
|
# See: https://www.edgedb.com/docs/reference/ddl/access_policies#nonrecursive
|
||||||
|
using future nonrecursive_access_policies;
|
||||||
2
apps/dev/nextjs/edgedb.toml
Normal file
2
apps/dev/nextjs/edgedb.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[edgedb]
|
||||||
|
server-version = "2.6"
|
||||||
45
apps/dev/nextjs/middleware.ts
Normal file
45
apps/dev/nextjs/middleware.ts
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
export { default } from "next-auth/middleware"
|
||||||
|
|
||||||
|
export const config = { matcher: ["/middleware-protected"] }
|
||||||
|
|
||||||
|
// Other ways to use this middleware
|
||||||
|
|
||||||
|
// import withAuth from "next-auth/middleware"
|
||||||
|
// import { withAuth } from "next-auth/middleware"
|
||||||
|
|
||||||
|
// export function middleware(req, ev) {
|
||||||
|
// return withAuth(req)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export function middleware(req, ev) {
|
||||||
|
// return withAuth(req, ev)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export function middleware(req, ev) {
|
||||||
|
// return withAuth(req, {
|
||||||
|
// callbacks: {
|
||||||
|
// authorized: ({ token }) => !!token,
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export default withAuth(function middleware(req, ev) {
|
||||||
|
// console.log(req.nextauth.token)
|
||||||
|
// })
|
||||||
|
|
||||||
|
// export default withAuth(
|
||||||
|
// function middleware(req, ev) {
|
||||||
|
// console.log(req, ev)
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// callbacks: {
|
||||||
|
// authorized: ({ token }) => token.name === "Balázs Orbán",
|
||||||
|
// },
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
|
||||||
|
// export default withAuth({
|
||||||
|
// callbacks: {
|
||||||
|
// authorized: ({ token }) => !!token,
|
||||||
|
// },
|
||||||
|
// })
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
|
/// <reference types="next/navigation-types/compat/navigation" />
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||||
9
apps/dev/nextjs/next.config.js
Normal file
9
apps/dev/nextjs/next.config.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/** @type {import("next").NextConfig} */
|
||||||
|
module.exports = {
|
||||||
|
webpack(config) {
|
||||||
|
config.experiments = { ...config.experiments, topLevelAwait: true }
|
||||||
|
return config
|
||||||
|
},
|
||||||
|
experimental: { appDir: true },
|
||||||
|
typescript: { ignoreBuildErrors: true },
|
||||||
|
}
|
||||||
46
apps/dev/nextjs/package.json
Normal file
46
apps/dev/nextjs/package.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "next-auth-app",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Next.js + Auth.js Developer app",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rm -rf .next",
|
||||||
|
"dev": "next dev",
|
||||||
|
"build": "next build",
|
||||||
|
"start": "next start",
|
||||||
|
"email": "fake-smtp-server",
|
||||||
|
"start:email": "pnpm email",
|
||||||
|
"e2e": "pnpm dlx playwright test"
|
||||||
|
},
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@auth/core": "workspace:*",
|
||||||
|
"@auth/edgedb-adapter": "workspace:*",
|
||||||
|
"@auth/fauna-adapter": "workspace:*",
|
||||||
|
"@auth/prisma-adapter": "workspace:*",
|
||||||
|
"@auth/supabase-adapter": "workspace:*",
|
||||||
|
"@auth/typeorm-adapter": "workspace:*",
|
||||||
|
"@prisma/client": "^3",
|
||||||
|
"edgedb": "^1.0.1",
|
||||||
|
"@supabase/supabase-js": "^2.0.5",
|
||||||
|
"faunadb": "^4",
|
||||||
|
"next": "13.4.0",
|
||||||
|
"next-auth": "workspace:*",
|
||||||
|
"nodemailer": "^6",
|
||||||
|
"react": "^18",
|
||||||
|
"react-dom": "^18"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@edgedb/generate": "^0.0.4",
|
||||||
|
"@playwright/test": "1.29.2",
|
||||||
|
"@types/jsonwebtoken": "^8.5.5",
|
||||||
|
"@types/react": "18.0.37",
|
||||||
|
"@types/react-dom": "^18.0.6",
|
||||||
|
"dotenv": "^16.0.3",
|
||||||
|
"fake-smtp-server": "^0.8.0",
|
||||||
|
"pg": "^8.7.3",
|
||||||
|
"prisma": "^3",
|
||||||
|
"sqlite3": "^5.0.8",
|
||||||
|
"typeorm": "0.3.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
apps/dev/nextjs/pages/_app.js
Normal file
10
apps/dev/nextjs/pages/_app.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { SessionProvider } from "next-auth/react"
|
||||||
|
import "./styles.css"
|
||||||
|
|
||||||
|
export default function App({ Component, pageProps }) {
|
||||||
|
return (
|
||||||
|
<SessionProvider session={pageProps.session}>
|
||||||
|
<Component {...pageProps} />
|
||||||
|
</SessionProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -2,12 +2,15 @@ import { Auth, type AuthConfig } from "@auth/core"
|
|||||||
|
|
||||||
// Providers
|
// Providers
|
||||||
import Apple from "@auth/core/providers/apple"
|
import Apple from "@auth/core/providers/apple"
|
||||||
|
// import Asgardeo from "@auth/core/providers/asgardeo"
|
||||||
import Auth0 from "@auth/core/providers/auth0"
|
import Auth0 from "@auth/core/providers/auth0"
|
||||||
import AzureAD from "@auth/core/providers/azure-ad"
|
import AzureAD from "@auth/core/providers/azure-ad"
|
||||||
import AzureB2C from "@auth/core/providers/azure-ad-b2c"
|
import AzureB2C from "@auth/core/providers/azure-ad-b2c"
|
||||||
|
// import BeyondIdentity from "@auth/core/providers/beyondidentity"
|
||||||
import BoxyHQSAML from "@auth/core/providers/boxyhq-saml"
|
import BoxyHQSAML from "@auth/core/providers/boxyhq-saml"
|
||||||
// import Cognito from "@auth/core/providers/cognito"
|
// import Cognito from "@auth/core/providers/cognito"
|
||||||
import Credentials from "@auth/core/providers/credentials"
|
import Credentials from "@auth/core/providers/credentials"
|
||||||
|
import Descope from "@auth/core/providers/descope"
|
||||||
import Discord from "@auth/core/providers/discord"
|
import Discord from "@auth/core/providers/discord"
|
||||||
import DuendeIDS6 from "@auth/core/providers/duende-identity-server6"
|
import DuendeIDS6 from "@auth/core/providers/duende-identity-server6"
|
||||||
// import Email from "@auth/core/providers/email"
|
// import Email from "@auth/core/providers/email"
|
||||||
@@ -23,6 +26,7 @@ import Instagram from "@auth/core/providers/instagram"
|
|||||||
import Line from "@auth/core/providers/line"
|
import Line from "@auth/core/providers/line"
|
||||||
import LinkedIn from "@auth/core/providers/linkedin"
|
import LinkedIn from "@auth/core/providers/linkedin"
|
||||||
import Mailchimp from "@auth/core/providers/mailchimp"
|
import Mailchimp from "@auth/core/providers/mailchimp"
|
||||||
|
import Notion from "@auth/core/providers/notion"
|
||||||
// import Okta from "@auth/core/providers/okta"
|
// import Okta from "@auth/core/providers/okta"
|
||||||
import Osu from "@auth/core/providers/osu"
|
import Osu from "@auth/core/providers/osu"
|
||||||
import Patreon from "@auth/core/providers/patreon"
|
import Patreon from "@auth/core/providers/patreon"
|
||||||
@@ -31,28 +35,29 @@ import Spotify from "@auth/core/providers/spotify"
|
|||||||
import Trakt from "@auth/core/providers/trakt"
|
import Trakt from "@auth/core/providers/trakt"
|
||||||
import Twitch from "@auth/core/providers/twitch"
|
import Twitch from "@auth/core/providers/twitch"
|
||||||
import Twitter from "@auth/core/providers/twitter"
|
import Twitter from "@auth/core/providers/twitter"
|
||||||
|
import Yandex from "@auth/core/providers/yandex"
|
||||||
import Vk from "@auth/core/providers/vk"
|
import Vk from "@auth/core/providers/vk"
|
||||||
import Wikimedia from "@auth/core/providers/wikimedia"
|
import Wikimedia from "@auth/core/providers/wikimedia"
|
||||||
import WorkOS from "@auth/core/providers/workos"
|
import WorkOS from "@auth/core/providers/workos"
|
||||||
|
import ClickUp from '@auth/core/providers/click-up'
|
||||||
// // Prisma
|
// // Prisma
|
||||||
// import { PrismaClient } from "@prisma/client"
|
// import { PrismaClient } from "@prisma/client"
|
||||||
// import { PrismaAdapter } from "@next-auth/prisma-adapter"
|
// import { PrismaAdapter } from "@auth/prisma-adapter"
|
||||||
// const client = globalThis.prisma || new PrismaClient()
|
// const client = globalThis.prisma || new PrismaClient()
|
||||||
// if (process.env.NODE_ENV !== "production") globalThis.prisma = client
|
// if (process.env.NODE_ENV !== "production") globalThis.prisma = client
|
||||||
// const adapter = PrismaAdapter(client)
|
// const adapter = PrismaAdapter(client)
|
||||||
|
|
||||||
// // Fauna
|
// // Fauna
|
||||||
// import { Client as FaunaClient } from "faunadb"
|
// import { Client as FaunaClient } from "faunadb"
|
||||||
// import { FaunaAdapter } from "@next-auth/fauna-adapter"
|
// import { FaunaAdapter } from "@auth/fauna-adapter"
|
||||||
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
|
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
|
||||||
// const client = globalThis.fauna || new FaunaClient(opts)
|
// const client = globalThis.fauna || new FaunaClient(opts)
|
||||||
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
|
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
|
||||||
// const adapter = FaunaAdapter(client)
|
// const adapter = FaunaAdapter(client)
|
||||||
|
|
||||||
// // TypeORM
|
// // TypeORM
|
||||||
// import { TypeORMLegacyAdapter } from "@next-auth/typeorm-legacy-adapter"
|
// import { TypeORMAdapter } from "@auth/typeorm-adapter"
|
||||||
// const adapter = TypeORMLegacyAdapter({
|
// const adapter = TypeORMAdapter({
|
||||||
// type: "sqlite",
|
// type: "sqlite",
|
||||||
// name: "next-auth-test-memory",
|
// name: "next-auth-test-memory",
|
||||||
// database: "./typeorm/dev.db",
|
// database: "./typeorm/dev.db",
|
||||||
@@ -60,15 +65,21 @@ import WorkOS from "@auth/core/providers/workos"
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
// // Supabase
|
// // Supabase
|
||||||
// import { SupabaseAdapter } from "@next-auth/supabase-adapter"
|
// import { SupabaseAdapter } from "@auth/supabase-adapter"
|
||||||
// const adapter = SupabaseAdapter({
|
// const adapter = SupabaseAdapter({
|
||||||
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||||
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
||||||
// })
|
// })
|
||||||
|
|
||||||
|
// // EdgeDB
|
||||||
|
// import { EdgeDBAdapter } from "@auth/edgedb-adapter"
|
||||||
|
// import { createHttpClient } from "edgedb"
|
||||||
|
// const client = createHttpClient()
|
||||||
|
// const adapter = EdgeDBAdapter(client)
|
||||||
|
|
||||||
export const authConfig: AuthConfig = {
|
export const authConfig: AuthConfig = {
|
||||||
// adapter,
|
// adapter,
|
||||||
// debug: process.env.NODE_ENV !== "production",
|
debug: process.env.NODE_ENV !== "production",
|
||||||
theme: {
|
theme: {
|
||||||
logo: "https://next-auth.js.org/img/logo/logo-sm.png",
|
logo: "https://next-auth.js.org/img/logo/logo-sm.png",
|
||||||
brandColor: "#1786fb",
|
brandColor: "#1786fb",
|
||||||
@@ -81,7 +92,8 @@ export const authConfig: AuthConfig = {
|
|||||||
return { name: "Fill Murray", email: "bill@fillmurray.com", image: "https://www.fillmurray.com/64/64", id: "1", foo: "" }
|
return { name: "Fill Murray", email: "bill@fillmurray.com", image: "https://www.fillmurray.com/64/64", id: "1", foo: "" }
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
Apple({ clientId: process.env.APPLE_ID, clientSecret: process.env.APPLE_SECRET }),
|
Apple({ clientId: process.env.APPLE_ID, clientSecret: process.env.APPLE_SECRET as string }),
|
||||||
|
// Asgardeo({ clientId: process.env.ASGARDEO_CLIENT_ID, clientSecret: process.env.ASGARDEO_CLIENT_SECRET, issuer: process.env.ASGARDEO_ISSUER }),
|
||||||
Auth0({ clientId: process.env.AUTH0_ID, clientSecret: process.env.AUTH0_SECRET, issuer: process.env.AUTH0_ISSUER }),
|
Auth0({ clientId: process.env.AUTH0_ID, clientSecret: process.env.AUTH0_SECRET, issuer: process.env.AUTH0_ISSUER }),
|
||||||
AzureAD({
|
AzureAD({
|
||||||
clientId: process.env.AZURE_AD_CLIENT_ID,
|
clientId: process.env.AZURE_AD_CLIENT_ID,
|
||||||
@@ -89,14 +101,20 @@ export const authConfig: AuthConfig = {
|
|||||||
tenantId: process.env.AZURE_AD_TENANT_ID,
|
tenantId: process.env.AZURE_AD_TENANT_ID,
|
||||||
}),
|
}),
|
||||||
AzureB2C({ clientId: process.env.AZURE_B2C_ID, clientSecret: process.env.AZURE_B2C_SECRET, issuer: process.env.AZURE_B2C_ISSUER }),
|
AzureB2C({ clientId: process.env.AZURE_B2C_ID, clientSecret: process.env.AZURE_B2C_SECRET, issuer: process.env.AZURE_B2C_ISSUER }),
|
||||||
|
// BeyondIdentity({
|
||||||
|
// clientId: process.env.BEYOND_IDENTITY_CLIENT_ID,
|
||||||
|
// clientSecret: process.env.BEYOND_IDENTITY_CLIENT_SECRET,
|
||||||
|
// issuer: process.env.BEYOND_IDENTITY_ISSUER,
|
||||||
|
// }),
|
||||||
BoxyHQSAML({ issuer: "https://jackson-demo.boxyhq.com", clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com", clientSecret: "dummy" }),
|
BoxyHQSAML({ issuer: "https://jackson-demo.boxyhq.com", clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com", clientSecret: "dummy" }),
|
||||||
// Cognito({ clientId: process.env.COGNITO_ID, clientSecret: process.env.COGNITO_SECRET, issuer: process.env.COGNITO_ISSUER }),
|
// Cognito({ clientId: process.env.COGNITO_ID, clientSecret: process.env.COGNITO_SECRET, issuer: process.env.COGNITO_ISSUER }),
|
||||||
|
Descope({ clientId: process.env.DESCOPE_ID, clientSecret: process.env.DESCOPE_SECRET }),
|
||||||
Discord({ clientId: process.env.DISCORD_ID, clientSecret: process.env.DISCORD_SECRET }),
|
Discord({ clientId: process.env.DISCORD_ID, clientSecret: process.env.DISCORD_SECRET }),
|
||||||
DuendeIDS6({ clientId: "interactive.confidential", clientSecret: "secret", issuer: "https://demo.duendesoftware.com" }),
|
DuendeIDS6({ clientId: "interactive.confidential", clientSecret: "secret", issuer: "https://demo.duendesoftware.com" }),
|
||||||
Facebook({ clientId: process.env.FACEBOOK_ID, clientSecret: process.env.FACEBOOK_SECRET }),
|
Facebook({ clientId: process.env.FACEBOOK_ID, clientSecret: process.env.FACEBOOK_SECRET }),
|
||||||
Foursquare({ clientId: process.env.FOURSQUARE_ID, clientSecret: process.env.FOURSQUARE_SECRET }),
|
Foursquare({ clientId: process.env.FOURSQUARE_ID, clientSecret: process.env.FOURSQUARE_SECRET }),
|
||||||
Freshbooks({ clientId: process.env.FRESHBOOKS_ID, clientSecret: process.env.FRESHBOOKS_SECRET }),
|
Freshbooks({ clientId: process.env.FRESHBOOKS_ID, clientSecret: process.env.FRESHBOOKS_SECRET }),
|
||||||
GitHub({ clientId: process.env.GITHUB_ID, clientSecret: process.env.GITHUB_SECRET }),
|
GitHub({ clientId: process.env.GITHUB_ID, clientSecret: process.env.GITHUB_SECRET, redirectProxyUrl: process.env.AUTH_REDIRECT_PROXY_URL }),
|
||||||
Gitlab({ clientId: process.env.GITLAB_ID, clientSecret: process.env.GITLAB_SECRET }),
|
Gitlab({ clientId: process.env.GITLAB_ID, clientSecret: process.env.GITLAB_SECRET }),
|
||||||
Google({ clientId: process.env.GOOGLE_ID, clientSecret: process.env.GOOGLE_SECRET }),
|
Google({ clientId: process.env.GOOGLE_ID, clientSecret: process.env.GOOGLE_SECRET }),
|
||||||
// IDS4({ clientId: process.env.IDS4_ID, clientSecret: process.env.IDS4_SECRET, issuer: process.env.IDS4_ISSUER }),
|
// IDS4({ clientId: process.env.IDS4_ID, clientSecret: process.env.IDS4_SECRET, issuer: process.env.IDS4_ISSUER }),
|
||||||
@@ -105,6 +123,7 @@ export const authConfig: AuthConfig = {
|
|||||||
Line({ clientId: process.env.LINE_ID, clientSecret: process.env.LINE_SECRET }),
|
Line({ clientId: process.env.LINE_ID, clientSecret: process.env.LINE_SECRET }),
|
||||||
LinkedIn({ clientId: process.env.LINKEDIN_ID, clientSecret: process.env.LINKEDIN_SECRET }),
|
LinkedIn({ clientId: process.env.LINKEDIN_ID, clientSecret: process.env.LINKEDIN_SECRET }),
|
||||||
Mailchimp({ clientId: process.env.MAILCHIMP_ID, clientSecret: process.env.MAILCHIMP_SECRET }),
|
Mailchimp({ clientId: process.env.MAILCHIMP_ID, clientSecret: process.env.MAILCHIMP_SECRET }),
|
||||||
|
Notion({ clientId: process.env.NOTION_ID, clientSecret: process.env.NOTION_SECRET, redirectUri: process.env.NOTION_REDIRECT_URI as string }),
|
||||||
// Okta({ clientId: process.env.OKTA_ID, clientSecret: process.env.OKTA_SECRET, issuer: process.env.OKTA_ISSUER }),
|
// Okta({ clientId: process.env.OKTA_ID, clientSecret: process.env.OKTA_SECRET, issuer: process.env.OKTA_ISSUER }),
|
||||||
Osu({ clientId: process.env.OSU_CLIENT_ID, clientSecret: process.env.OSU_CLIENT_SECRET }),
|
Osu({ clientId: process.env.OSU_CLIENT_ID, clientSecret: process.env.OSU_CLIENT_SECRET }),
|
||||||
Patreon({ clientId: process.env.PATREON_ID, clientSecret: process.env.PATREON_SECRET }),
|
Patreon({ clientId: process.env.PATREON_ID, clientSecret: process.env.PATREON_SECRET }),
|
||||||
@@ -114,9 +133,11 @@ export const authConfig: AuthConfig = {
|
|||||||
Twitch({ clientId: process.env.TWITCH_ID, clientSecret: process.env.TWITCH_SECRET }),
|
Twitch({ clientId: process.env.TWITCH_ID, clientSecret: process.env.TWITCH_SECRET }),
|
||||||
Twitter({ clientId: process.env.TWITTER_ID, clientSecret: process.env.TWITTER_SECRET }),
|
Twitter({ clientId: process.env.TWITTER_ID, clientSecret: process.env.TWITTER_SECRET }),
|
||||||
// TwitterLegacy({ clientId: process.env.TWITTER_LEGACY_ID, clientSecret: process.env.TWITTER_LEGACY_SECRET }),
|
// TwitterLegacy({ clientId: process.env.TWITTER_LEGACY_ID, clientSecret: process.env.TWITTER_LEGACY_SECRET }),
|
||||||
|
Yandex({ clientId: process.env.YANDEX_ID, clientSecret: process.env.YANDEX_SECRET }),
|
||||||
Vk({ clientId: process.env.VK_ID, clientSecret: process.env.VK_SECRET }),
|
Vk({ clientId: process.env.VK_ID, clientSecret: process.env.VK_SECRET }),
|
||||||
Wikimedia({ clientId: process.env.WIKIMEDIA_ID, clientSecret: process.env.WIKIMEDIA_SECRET }),
|
Wikimedia({ clientId: process.env.WIKIMEDIA_ID, clientSecret: process.env.WIKIMEDIA_SECRET }),
|
||||||
WorkOS({ clientId: process.env.WORKOS_ID, clientSecret: process.env.WORKOS_SECRET }),
|
WorkOS({ clientId: process.env.WORKOS_ID, clientSecret: process.env.WORKOS_SECRET }),
|
||||||
|
ClickUp({ clientId: process.env.CLICK_UP_ID, clientSecret: process.env.CLICK_UP_SECRET })
|
||||||
],
|
],
|
||||||
// debug: process.env.NODE_ENV !== "production",
|
// debug: process.env.NODE_ENV !== "production",
|
||||||
}
|
}
|
||||||
@@ -148,4 +169,4 @@ function AuthHandler(...args: any[]) {
|
|||||||
|
|
||||||
export default AuthHandler(authConfig)
|
export default AuthHandler(authConfig)
|
||||||
|
|
||||||
export const config = { runtime: "experimental-edge" }
|
export const config = { runtime: "edge" }
|
||||||
7
apps/dev/nextjs/pages/api/examples/jwt.js
Normal file
7
apps/dev/nextjs/pages/api/examples/jwt.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// This is an example of how to read a JSON Web Token from an API route
|
||||||
|
import { getToken } from "next-auth/jwt"
|
||||||
|
|
||||||
|
export default async (req, res) => {
|
||||||
|
const token = await getToken({ req })
|
||||||
|
res.send(JSON.stringify(token, null, 2))
|
||||||
|
}
|
||||||
67
apps/dev/nextjs/pages/credentials.js
Normal file
67
apps/dev/nextjs/pages/credentials.js
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
// eslint-disable-next-line no-use-before-define
|
||||||
|
import * as React from "react"
|
||||||
|
import { signIn, signOut, useSession } from "next-auth/react"
|
||||||
|
import Layout from "components/layout"
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
const [response, setResponse] = React.useState(null)
|
||||||
|
const handleLogin = (options) => async () => {
|
||||||
|
if (options.redirect) {
|
||||||
|
return signIn("credentials", options)
|
||||||
|
}
|
||||||
|
const response = await signIn("credentials", options)
|
||||||
|
setResponse(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleLogout = (options) => async () => {
|
||||||
|
if (options.redirect) {
|
||||||
|
return signOut(options)
|
||||||
|
}
|
||||||
|
const response = await signOut(options)
|
||||||
|
setResponse(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data: session } = useSession()
|
||||||
|
|
||||||
|
if (session) {
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Test different flows for Credentials logout</h1>
|
||||||
|
<span className="spacing">Default:</span>
|
||||||
|
<button onClick={handleLogout({ redirect: true })}>Logout</button>
|
||||||
|
<br />
|
||||||
|
<span className="spacing">No redirect:</span>
|
||||||
|
<button onClick={handleLogout({ redirect: false })}>Logout</button>
|
||||||
|
<br />
|
||||||
|
<p>Response:</p>
|
||||||
|
<pre style={{ background: "#eee", padding: 16 }}>
|
||||||
|
{JSON.stringify(response, null, 2)}
|
||||||
|
</pre>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Test different flows for Credentials login</h1>
|
||||||
|
<span className="spacing">Default:</span>
|
||||||
|
<button onClick={handleLogin({ redirect: true, password: "password" })}>
|
||||||
|
Login
|
||||||
|
</button>
|
||||||
|
<br />
|
||||||
|
<span className="spacing">No redirect:</span>
|
||||||
|
<button onClick={handleLogin({ redirect: false, password: "password" })}>
|
||||||
|
Login
|
||||||
|
</button>
|
||||||
|
<br />
|
||||||
|
<span className="spacing">No redirect, wrong password:</span>
|
||||||
|
<button onClick={handleLogin({ redirect: false, password: "" })}>
|
||||||
|
Login
|
||||||
|
</button>
|
||||||
|
<p>Response:</p>
|
||||||
|
<pre style={{ background: "#eee", padding: 16 }}>
|
||||||
|
{JSON.stringify(response, null, 2)}
|
||||||
|
</pre>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
80
apps/dev/nextjs/pages/email.js
Normal file
80
apps/dev/nextjs/pages/email.js
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
// eslint-disable-next-line no-use-before-define
|
||||||
|
import * as React from "react"
|
||||||
|
import { signIn, signOut, useSession } from "next-auth/react"
|
||||||
|
import Layout from "components/layout"
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
const [response, setResponse] = React.useState(null)
|
||||||
|
const [email, setEmail] = React.useState("")
|
||||||
|
|
||||||
|
const handleChange = (event) => {
|
||||||
|
setEmail(event.target.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleLogin = (options) => async (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
if (options.redirect) {
|
||||||
|
return signIn("email", options)
|
||||||
|
}
|
||||||
|
const response = await signIn("email", options)
|
||||||
|
setResponse(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleLogout = (options) => async (event) => {
|
||||||
|
if (options.redirect) {
|
||||||
|
return signOut(options)
|
||||||
|
}
|
||||||
|
const response = await signOut(options)
|
||||||
|
setResponse(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data: session } = useSession()
|
||||||
|
|
||||||
|
if (session) {
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Test different flows for Email logout</h1>
|
||||||
|
<span className="spacing">Default:</span>
|
||||||
|
<button onClick={handleLogout({ redirect: true })}>Logout</button>
|
||||||
|
<br />
|
||||||
|
<span className="spacing">No redirect:</span>
|
||||||
|
<button onClick={handleLogout({ redirect: false })}>Logout</button>
|
||||||
|
<br />
|
||||||
|
<p>Response:</p>
|
||||||
|
<pre style={{ background: "#eee", padding: 16 }}>
|
||||||
|
{JSON.stringify(response, null, 2)}
|
||||||
|
</pre>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Test different flows for Email login</h1>
|
||||||
|
<label className="spacing">
|
||||||
|
Email address:{" "}
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="email"
|
||||||
|
name="email"
|
||||||
|
value={email}
|
||||||
|
onChange={handleChange}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<br />
|
||||||
|
<form onSubmit={handleLogin({ redirect: true, email })}>
|
||||||
|
<span className="spacing">Default:</span>
|
||||||
|
<button type="submit">Sign in with Email</button>
|
||||||
|
</form>
|
||||||
|
<form onSubmit={handleLogin({ redirect: false, email })}>
|
||||||
|
<span className="spacing">No redirect:</span>
|
||||||
|
<button type="submit">Sign in with Email</button>
|
||||||
|
</form>
|
||||||
|
<p>Response:</p>
|
||||||
|
<pre style={{ background: "#eee", padding: 16 }}>
|
||||||
|
{JSON.stringify(response, null, 2)}
|
||||||
|
</pre>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
9
apps/dev/nextjs/pages/middleware-protected/index.js
Normal file
9
apps/dev/nextjs/pages/middleware-protected/index.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import Layout from "components/layout"
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Page protected by Middleware</h1>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
35
apps/dev/nextjs/pages/protected.js
Normal file
35
apps/dev/nextjs/pages/protected.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { useState, useEffect } from "react"
|
||||||
|
import { useSession } from "next-auth/react"
|
||||||
|
import Layout from "../components/layout"
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
const { status } = useSession({
|
||||||
|
required: true,
|
||||||
|
})
|
||||||
|
const [content, setContent] = useState()
|
||||||
|
|
||||||
|
// Fetch content from protected route
|
||||||
|
useEffect(() => {
|
||||||
|
if (status === "loading") return
|
||||||
|
const fetchData = async () => {
|
||||||
|
const res = await fetch("/api/examples/protected")
|
||||||
|
const json = await res.json()
|
||||||
|
if (json.content) {
|
||||||
|
setContent(json.content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fetchData()
|
||||||
|
}, [status])
|
||||||
|
|
||||||
|
if (status === "loading") return <Layout>Loading...</Layout>
|
||||||
|
|
||||||
|
// If session exists, display content
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<h1>Protected Page</h1>
|
||||||
|
<p>
|
||||||
|
<strong>{content}</strong>
|
||||||
|
</p>
|
||||||
|
</Layout>
|
||||||
|
)
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user