Skip to content

Commit

Permalink
Merge pull request #101 from kinde-oss/peter/fix-middleware
Browse files Browse the repository at this point in the history
Peter/fix middleware
  • Loading branch information
peterphanouvong authored Dec 6, 2023
2 parents 69a6195 + b8d1216 commit 4b100fa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 2 additions & 5 deletions src/authMiddleware/authMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,18 @@ 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}) ??
isTokenValid(kindeToken.value);

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)
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4b100fa

Please sign in to comment.