Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

fix(auth, ui): clear stale tokens on fatal 4xx and provide user-friendly OAuth guidance

Rafael Abud Ferreira3a1f597b63e9
diff --git a/src/app/worker.cpp b/src/app/worker.cpp
index 88f566c..9fbd67b 100644
--- a/src/app/worker.cpp
+++ b/src/app/worker.cpp
@@ -615,6 +615,10 @@ void signInAndLoad(auth::AuthManager& am, xcloud::GssvClient& gssv) {
} else if (net::lastTlsProblem() == net::TlsProblem::Untrusted ||
net::lastTlsProblem() == net::TlsProblem::NameMismatch) {
g_ui->showError(ui::tr(ui::Str::ConnectionIntercepted));
+ } else if (err.find("user interaction is required") != std::string::npos ||
+ err.find("invalid_grant") != std::string::npos ||
+ err.find("authorization_declined") != std::string::npos) {
+ g_ui->showError(ui::tr(ui::Str::SignInInteractionRequired));
} else {
g_ui->showError(ui::trf(ui::Str::SignInFailed, err));
}
diff --git a/src/auth/auth_manager.cpp b/src/auth/auth_manager.cpp
index 08b0875..2af560a 100644
--- a/src/auth/auth_manager.cpp
+++ b/src/auth/auth_manager.cpp
@@ -369,6 +369,7 @@ bool AuthManager::signIn(xcloud::GssvClient& gssv, const DeviceCodeCallback& onC
} else {
XC_LOGW("stored sign-in no longer valid (%s); asking again", err.c_str());
tokens_ = {};
+ std::remove(storePath_.c_str());
}
}
if (tokens_.accessToken.empty()) {
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 4fef8e7..4674f6d 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -73,6 +73,7 @@ constexpr Column kEnglish = {
"Hold to sign out", // HoldSignOut
"Keep holding to sign out (%s)", // SigningOutIn
"Sign-in failed: %s", // SignInFailed
+ "Sign-in not completed in the browser. Use a personal Microsoft account, complete any security prompts/2FA, and grant access to the app.", // SignInInteractionRequired
"Could not load the game list: %s", // LibraryFailed
"Could not start the stream: %s", // StreamFailed
"No input for a while: you will be disconnected in %s seconds", // IdleWarning
@@ -366,6 +367,7 @@ constexpr Column kPortugueseBR = {
"Segure para sair da conta",
"Continue segurando para sair da conta (%s)",
"Falha ao entrar: %s",
+ "O login no navegador não foi concluído. Use uma conta pessoal da Microsoft, conclua verificações de segurança/2FA e autorize o app.",
"Não foi possível carregar a lista de jogos: %s",
"Não foi possível iniciar o streaming: %s",
"Sem atividade: você será desconectado em %s segundos",
@@ -659,6 +661,7 @@ constexpr Column kSpanish = {
"Mantén para cerrar sesión",
"Sigue manteniendo para cerrar sesión (%s)",
"Error al iniciar sesión: %s",
+ "El inicio de sesión no se completó en el navegador. Usa una cuenta personal de Microsoft, completa la verificación/2FA y autoriza la app.",
"No se pudo cargar la lista de juegos: %s",
"No se pudo iniciar el streaming: %s",
"Sin actividad: se te desconectará en %s segundos",
@@ -952,6 +955,7 @@ constexpr Column kFrench = {
"Maintenez pour vous déconnecter",
"Continuez à maintenir pour vous déconnecter (%s)",
"Échec de la connexion : %s",
+ "La connexion dans le navigateur n'a pas été finalisée. Utilisez un compte Microsoft personnel, effectuez les vérifications/2FA et autorisez l'app.",
"Impossible de charger la liste des jeux : %s",
"Impossible de démarrer le streaming : %s",
"Aucune activité : vous serez déconnecté dans %s secondes",
@@ -1245,6 +1249,7 @@ constexpr Column kGerman = {
"Halten zum Abmelden",
"Weiter halten zum Abmelden (%s)",
"Anmeldung fehlgeschlagen: %s",
+ "Die Anmeldung im Browser wurde nicht abgeschlossen. Verwende ein persönliches Microsoft-Konto, schließe Sicherheitsabfragen/2FA ab und gewähre Zugriff.",
"Die Spieleliste konnte nicht geladen werden: %s",
"Das Streaming konnte nicht gestartet werden: %s",
"Keine Aktivität: Die Verbindung wird in %s Sekunden getrennt",
@@ -1538,6 +1543,7 @@ constexpr Column kItalian = {
"Tieni premuto per uscire",
"Continua a tenere premuto per uscire (%s)",
"Accesso non riuscito: %s",
+ "L'accesso nel browser non è stato completato. Utilizza un account Microsoft personale, completa le verifiche/2FA e autorizza l'app.",
"Impossibile caricare l'elenco dei giochi: %s",
"Impossibile avviare lo streaming: %s",
"Nessuna attività: verrai disconnesso tra %s secondi",
diff --git a/src/ui/strings.h b/src/ui/strings.h
index b3a75b5..d61e9a9 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -50,6 +50,7 @@ enum class Str {
HoldSignOut,
SigningOutIn, // "%s" = seconds left
SignInFailed, // "%s" = technical detail
+ SignInInteractionRequired,
LibraryFailed, // "%s" = technical detail
StreamFailed, // "%s" = technical detail
IdleWarning, // "%s" = seconds until the server disconnects