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
// Check for Google Workspace session control errors (RAPT - Reauthentication Policy Token)
1196
+
// This occurs when the organization enforces periodic re-authentication
1197
+
if(
1198
+
typeoferrorData==='object'&&
1199
+
(errorData.error_subtype==='invalid_rapt'||
1200
+
errorData.error_description?.includes('reauth related error'))
1201
+
){
1202
+
thrownewError(
1203
+
`Session expired due to organization security policy. Please reconnect your ${providerId} account to continue. Alternatively, ask your Google Workspace admin to exempt this app from session control: Admin Console → Security → Google Cloud session control → "Exempt trusted apps".`
1204
+
)
1205
+
}
1206
+
1207
+
if(
1208
+
typeoferrorData==='object'&&
1209
+
errorData.error==='invalid_grant'&&
1210
+
!errorData.error_subtype
1211
+
){
1212
+
thrownewError(
1213
+
`Access has been revoked or the refresh token is no longer valid. Please reconnect your ${providerId} account.`
1214
+
)
1215
+
}
1216
+
1194
1217
thrownewError(`Failed to refresh token: ${response.status}${errorText}`)
1195
1218
}
1196
1219
@@ -1224,6 +1247,8 @@ export async function refreshOAuthToken(
1224
1247
}
1225
1248
}catch(error){
1226
1249
logger.error('Error refreshing token:',{ error })
1227
-
returnnull
1250
+
// Re-throw specific errors so they propagate with their detailed messages
1251
+
// Only return null for truly unexpected errors without useful messages
0 commit comments