Skip to content

Commit

Permalink
Merge pull request #52 from kinde-oss/dave/bug/token-payload
Browse files Browse the repository at this point in the history
Token payload
  • Loading branch information
DaveOrDead authored Aug 31, 2023
2 parents 29b24be + c612fcb commit 1fb297c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/handlers/pageRouter/callback.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {config} from '../../config/index';
import {isTokenValid} from '../../utils/pageRouter/isTokenValid';
import {version} from '../../utils/version';
import jwt_decode from 'jwt-decode';

var cookie = require('cookie');

Expand Down Expand Up @@ -32,12 +33,13 @@ export const callback = async (req, res) => {
);
const data = await response.json();

const accessToken = jwt_decode(data.access_token);
if (isTokenValid(data)) {
res.setHeader(
'Set-Cookie',
cookie.serialize(`kinde_token`, JSON.stringify(data), {
httpOnly: true,
expires: new Date(accessTokenPayload.exp * 1000),
expires: new Date(accessToken.exp * 1000),
sameSite: 'lax',
secure: config.redirectURL.substring(0, 6) == 'https:',
path: '/'
Expand Down

0 comments on commit 1fb297c

Please sign in to comment.