diff --git a/package-lock.json b/package-lock.json index 2995078..fe308a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@kinde-oss/kinde-auth-nextjs", - "version": "2.0.9", + "version": "2.0.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@kinde-oss/kinde-auth-nextjs", - "version": "2.0.9", + "version": "2.0.10", "dependencies": { "@kinde-oss/kinde-typescript-sdk": "^2.3.0", "cookie": "^0.5.0", diff --git a/package.json b/package.json index 1440149..ce7edb8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kinde-oss/kinde-auth-nextjs", - "version": "2.0.9", + "version": "2.0.10", "description": "Kinde Auth SDK for NextJS", "main": "dist/cjs/index.js", "module": "dist/index.js", diff --git a/src/authMiddleware/authMiddleware.js b/src/authMiddleware/authMiddleware.js index ae284db..0ae7845 100644 --- a/src/authMiddleware/authMiddleware.js +++ b/src/authMiddleware/authMiddleware.js @@ -49,13 +49,10 @@ const handleMiddleware = async (req, options, onSuccess) => { config.redirectURL ) ); - response.headers.set('x-hello-from-middleware2', 'hello'); return response; } - const accessTokenValue = JSON.parse( - req.cookies.get('access_token_payload').value - ); + const accessTokenValue = jwt_decode(req.cookies.get('access_token').value); const isAuthorized = options?.isAuthorized({req, token: accessTokenValue}) ?? @@ -63,7 +60,7 @@ const handleMiddleware = async (req, options, onSuccess) => { if (isAuthorized && onSuccess) { return await onSuccess({ - token: JSON.parse(req.cookies.get('access_token_payload').value), + token: accessTokenValue, user: JSON.parse(req.cookies.get('user').value) }); } diff --git a/src/utils/version.js b/src/utils/version.js index 9995b8c..5418dfd 100644 --- a/src/utils/version.js +++ b/src/utils/version.js @@ -1,2 +1,2 @@ // Generated by genversion. -export const version = '2.0.9' +export const version = '2.0.10'