Fix for bad auth token (#90)

This commit is contained in:
Brahim Hadriche authored and GitHub committed 2023-06-28 09:27:04 -04:00
1 parent d80240130d
commit a675811488
3 files changed
+12 -1

No files matched your search

@@ -157,6 +157,8 @@ class InvidiousService
' Public Invidious instances fail a lot randomly, even with valid tokens
' For that reason, it's better to make sure the token actually expired by date
' TODO: this happens because instance owners do not set hmac_key https://github.com/iv-org/invidious/issues/3854
' Once hmac_key is enforced, this check can be removed.
function IsTokenMaybeExpired() as dynamic
authToken = InvidiousSettings.GetAuthToken()
if authToken = invalid
@@ -39,7 +39,12 @@ namespace InvidiousSettings
if tokenPayload = invalid
return invalid
end if
return ParseJson(tokenPayload)
authData = ParseJson(tokenPayload)
if authData = invalid or authData.instance = invalid or authData.token = invalid
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_TOKEN)
return invalid
end if
return authData
end function
function GetBackupInstances() as object