-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Peter/v2 hot fixes #84
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import jwt_decode from 'jwt-decode'; | ||
import {NextResponse} from 'next/server'; | ||
import {config} from '../config/index'; | ||
import {isTokenValid} from '../utils/pageRouter/isTokenValid'; | ||
|
@@ -10,11 +9,10 @@ export function authMiddleware(request) { | |
let isAuthenticated = false; | ||
const nextUrl = trimTrailingSlash(request.nextUrl.href); | ||
const logoutUrl = trimTrailingSlash(config.postLogoutRedirectURL); | ||
const kinde_token = request.cookies.get('kinde_token'); | ||
const kinde_token = request.cookies.get('access_token'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @peterphanouvong is this right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DaveOrDead yea, using TS SDK sets There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm I see. Seems this would create breaking changes for anyone accessing the cookie directly. Could we instead update the TS SDK to allow a cookie name to be passed? That way we can pass |
||
const isLogoutUrl = nextUrl === logoutUrl; | ||
|
||
if (kinde_token) { | ||
const payload = jwt_decode(JSON.parse(kinde_token.value).access_token); | ||
isAuthenticated = true; | ||
} | ||
|
||
|
@@ -49,7 +47,6 @@ const handleMiddleware = async (req, options, onSuccess) => { | |
config.redirectURL | ||
) | ||
); | ||
response.headers.set('x-hello-from-middleware2', 'hello'); | ||
return response; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀