Update OAuth2.md
This commit is contained in:
parent
99168d254a
commit
a7ae47f2bb
@ -321,6 +321,7 @@ app.get('/api/dashboard-data', async (req, res) => {
|
|||||||
const refreshToken = await getRefreshTokenFromDB(); // Get from your DB
|
const refreshToken = await getRefreshTokenFromDB(); // Get from your DB
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the token is still valid
|
// If the token is still valid
|
||||||
//
|
//
|
||||||
@ -330,6 +331,7 @@ app.get('/api/dashboard-data', async (req, res) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.name === 'TokenExpiredError') {
|
if (err.name === 'TokenExpiredError') {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//
|
//
|
||||||
// 1. Get new tokens using refresh token
|
// 1. Get new tokens using refresh token
|
||||||
//
|
//
|
||||||
@ -361,6 +363,7 @@ app.get('/api/dashboard-data', async (req, res) => {
|
|||||||
const dashboardData = await getDashboardData(userData);
|
const dashboardData = await getDashboardData(userData);
|
||||||
res.json(dashboardData);
|
res.json(dashboardData);
|
||||||
} catch (refreshError) {
|
} catch (refreshError) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If refresh fails, user needs to login again
|
// If refresh fails, user needs to login again
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user