@opensaas/keystone-nextjs-auth 25.0.0-rc-1 → 25.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.json +4 -4
- package/src/index.ts +4 -4
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@opensaas/keystone-nextjs-auth",
|
3
|
-
"version": "25.0.0
|
3
|
+
"version": "25.0.0",
|
4
4
|
"repository": "https://github.com/opensaasau/keystone-nextjs-auth",
|
5
5
|
"license": "MIT",
|
6
6
|
"main": "dist/opensaas-keystone-nextjs-auth.cjs.js",
|
@@ -13,14 +13,14 @@
|
|
13
13
|
"cross-fetch": "^3.1.5",
|
14
14
|
"ejs": "^3.1.8",
|
15
15
|
"fast-deep-equal": "^3.1.3",
|
16
|
-
"next-auth": "^4.
|
16
|
+
"next-auth": "^4.14.0"
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
|
-
"@keystone-6/core": "
|
19
|
+
"@keystone-6/core": "3.0.0",
|
20
20
|
"react": "^18.2.0"
|
21
21
|
},
|
22
22
|
"peerDependencies": {
|
23
|
-
"@keystone-6/core": "
|
23
|
+
"@keystone-6/core": "3.0.0",
|
24
24
|
"react": "^18.2.0"
|
25
25
|
},
|
26
26
|
"publishConfig": {
|
package/src/index.ts
CHANGED
@@ -14,7 +14,7 @@ import { Provider } from 'next-auth/providers';
|
|
14
14
|
|
15
15
|
import * as cookie from 'cookie';
|
16
16
|
|
17
|
-
import { Session } from 'next-auth';
|
17
|
+
import { JWT, Session } from 'next-auth';
|
18
18
|
import { nextConfigTemplate } from './templates/next-config';
|
19
19
|
// import * as Path from 'path';
|
20
20
|
|
@@ -199,17 +199,17 @@ export function createAuth<GeneratedListTypes extends BaseListTypeInfo>({
|
|
199
199
|
...sessionStrategy,
|
200
200
|
get: async ({ req, createContext }) => {
|
201
201
|
const pathname = url.parse(req?.url!).pathname!;
|
202
|
-
let nextSession: Session;
|
202
|
+
let nextSession: Session | JWT | null;
|
203
203
|
if (pathname.includes('/api/auth')) {
|
204
204
|
return;
|
205
205
|
}
|
206
206
|
const sudoContext = createContext({ sudo: true });
|
207
207
|
|
208
208
|
if (req.headers?.authorization?.split(' ')[0] === 'Bearer') {
|
209
|
-
nextSession =
|
209
|
+
nextSession = await getToken({
|
210
210
|
req,
|
211
211
|
secret: sessionSecret,
|
212
|
-
})
|
212
|
+
});
|
213
213
|
} else {
|
214
214
|
nextSession = (await getSession({ req })) as Session;
|
215
215
|
}
|