You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
try {
// Here, check the token validity date
//if (token.exp < Date.now() / 1000) {
// Call the endpoint where you handle the token refresh for a user
const user = await axios.post(`${process.env.DUENDE_IDS6_ISSUER || config.get('DUENDE_IDS6_ISSUER')}/connect/token`,
{
headers: { "Content-Type": "application/x-www-form-urlencoded" },
clientId: process.env.DUENDE_IDS6_CLIENT_ID || config.get('DUENDE_IDS6_CLIENT_ID'),
clientSecret: process.env.DUENDE_IDS6_CLIENT_SECRET || config.get('DUENDE_IDS6_CLIENT_SECRET'),
grant_type: "refresh_token",
refreshToken: token.refresh_token
}
);
if (!user) throw user
console.log(`jwt() user refreshed: ${JSON.stringify(user, null, 2)}`);
} catch (error) {
console.error("Error refreshing access token", error)
// The error property will be used client-side to handle the refresh token error
return { ...token, error: "RefreshAccessTokenError" as const }
}
providerstriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
1 participant
Converted from issue
This discussion was converted from issue #8683 on September 22, 2023 08:23.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Provider type
Identity Server 4
Environment
System:
OS: Linux 6.2 Ubuntu 23.04 23.04 (Lunar Lobster)
CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz
Memory: 51.85 GB / 70.38 GB
Container: Yes
Shell: 5.2.15 - /bin/bash
Binaries:
Node: 20.3.1 - /usr/local/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 9.8.1 - /usr/local/bin/npm
pnpm: 8.7.6 - /usr/local/bin/pnpm
Browsers:
Chrome: 117.0.5938.92
Reproduction URL
https://github.com/nextauthjs/next-auth-example
Describe the issue
How to reproduce
Use next-auth-example and configure as provided.
Expected behavior
Successfully refreshed access token using the refresh token.
Beta Was this translation helpful? Give feedback.
All reactions