fix(sync): 403 insufficientPermissions -> scope youtube complet + invite reconnect
This commit is contained in:
@@ -681,6 +681,10 @@ r.get('/oauth/google/watchlater', authMiddlewareCookieAware, oauthLimiter, async
|
||||
} catch (error) {
|
||||
const out = { error: error?.message || 'watchlater_fetch_failed' };
|
||||
if (error?.hint) out.hint = error.hint;
|
||||
if (error?.ytReason) out.ytReason = error.ytReason;
|
||||
if (!out.hint && String(error?.ytReason || '').toLowerCase().includes('insufficientpermissions')) {
|
||||
out.hint = 'Scope manquant : déconnectez puis reconnectez Google pour autoriser l’accès complet YouTube.';
|
||||
}
|
||||
return res.status(error?.status || 502).json(out);
|
||||
}
|
||||
});
|
||||
@@ -719,6 +723,8 @@ r.get('/oauth/google/yt-history', authMiddlewareCookieAware, oauthLimiter, async
|
||||
if (error?.ytReason) out.ytReason = error.ytReason;
|
||||
if (error?.status === 401) {
|
||||
out.hint = 'Session Google expirée : déconnectez puis reconnectez Google.';
|
||||
} else if (String(error?.ytReason || '').toLowerCase().includes('insufficientpermissions')) {
|
||||
out.hint = 'Scope manquant : déconnectez puis reconnectez Google pour autoriser l’accès complet YouTube.';
|
||||
}
|
||||
return res.status(error?.status || 502).json(out);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ const GOOGLE_SCOPES = [
|
||||
// Écriture Watch Later (playlistItems.insert/delete). Lecture seule
|
||||
// (abos, likes, WL) fonctionne sans lui ; le push exige un re-consentement.
|
||||
'https://www.googleapis.com/auth/youtube.force-ssl',
|
||||
// InnerTube authentifié (historique FEhistory, playlist WL) exige le scope
|
||||
// complet : avec readonly seul, YouTube répond 403 insufficientPermissions.
|
||||
// Les connexions existantes doivent se reconnecter pour l'obtenir.
|
||||
'https://www.googleapis.com/auth/youtube',
|
||||
].join(' ');
|
||||
|
||||
/** Le jeton stocké permet-il l'écriture (push Watch Later) ? */
|
||||
|
||||
Reference in New Issue
Block a user