mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
401 reauth experiments
This commit is contained in:
@@ -45,6 +45,7 @@ export const authOptions: AuthOptions = {
|
||||
},
|
||||
callbacks: {
|
||||
async jwt({ token, account, user }) {
|
||||
console.log("token.sub jwt callback", token.sub);
|
||||
const KEY = `token:${token.sub}`;
|
||||
|
||||
if (account && user) {
|
||||
@@ -70,6 +71,13 @@ export const authOptions: AuthOptions = {
|
||||
}
|
||||
|
||||
const currentToken = await getTokenCache(tokenCacheRedis, KEY);
|
||||
console.log(
|
||||
"currentToken.token.accessTokenExpires",
|
||||
currentToken?.token?.accessTokenExpires,
|
||||
currentToken?.token?.accessTokenExpires
|
||||
? Date.now() < currentToken?.token?.accessTokenExpires
|
||||
: "?",
|
||||
);
|
||||
if (currentToken && Date.now() < currentToken.token.accessTokenExpires) {
|
||||
return currentToken.token;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user