Skip to content

Commit

Permalink
Merge pull request #189 from kinde-oss/peter/fix/istokenvalid-check-a…
Browse files Browse the repository at this point in the history
…udience

Peter/fix/istokenvalid check audience
  • Loading branch information
peterphanouvong authored Jul 22, 2024
2 parents 7c62a2b + 8d0332f commit 2db7533
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
7 changes: 2 additions & 5 deletions playground/src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
authMiddleware,
withAuth,
} from "@kinde-oss/kinde-auth-nextjs/middleware";
import {withAuth} from '@kinde-oss/kinde-auth-nextjs/middleware';

export default function middleware(req: Request) {
return withAuth(req);
}

export const config = {
matcher: ["/dashboard"],
matcher: ['/dashboard']
};
2 changes: 1 addition & 1 deletion src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const config = {
clientID: KINDE_CLIENT_ID,
clientSecret: KINDE_CLIENT_SECRET,
postLogoutRedirectURL: KINDE_POST_LOGOUT_REDIRECT_URL,
audience: KINDE_AUDIENCE,
audience: KINDE_AUDIENCE ? KINDE_AUDIENCE.split(' ') : '',
cookieDomain: KINDE_COOKIE_DOMAIN,
responseType: 'code',
codeChallengeMethod: 'S256',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/pageRouter/isTokenValid.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const isTokenValid = (token) => {
if (config.audience)
isAudienceValid =
accessTokenPayload.aud &&
accessTokenPayload.aud.includes(config.audience);
accessTokenPayload.aud.includes(...config.audience);

if (
accessTokenPayload.iss == config.issuerURL &&
Expand Down
1 change: 1 addition & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
export type KindeAccessToken = {
aud: string[];
azp: number;
exp: number;
iat: number;
iss: string;
jti: string;
Expand Down

0 comments on commit 2db7533

Please sign in to comment.