From a7ae47f2bb01f05765983a1d0746e18418be0c9a Mon Sep 17 00:00:00 2001 From: Ste Vaidis Date: Wed, 8 Jan 2025 12:49:25 +0200 Subject: [PATCH] Update OAuth2.md --- OAuth2.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OAuth2.md b/OAuth2.md index 5f2a665..6adcd21 100644 --- a/OAuth2.md +++ b/OAuth2.md @@ -321,6 +321,7 @@ app.get('/api/dashboard-data', async (req, res) => { const refreshToken = await getRefreshTokenFromDB(); // Get from your DB try { + // // If the token is still valid // @@ -330,6 +331,7 @@ app.get('/api/dashboard-data', async (req, res) => { } catch (err) { if (err.name === 'TokenExpiredError') { try { + // // 1. Get new tokens using refresh token // @@ -361,6 +363,7 @@ app.get('/api/dashboard-data', async (req, res) => { const dashboardData = await getDashboardData(userData); res.json(dashboardData); } catch (refreshError) { + // // If refresh fails, user needs to login again //