* OAuth refresh token * Lint fix * tweak refresh logic * error handling cancelled request * Ignore endScreenPlaylistRenderer --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
26 lines
957 B
Plaintext
26 lines
957 B
Plaintext
import "pkg:/components/Services/Innertube/InnertubeService.bs"
|
|
import "pkg:/source/utils/ErrorUtils.bs"
|
|
|
|
@asynctask
|
|
function ProfileRefreshTokenTask(input as object) as object
|
|
profileNode = input.profile
|
|
accessTokenObject = input.accessTokenObject
|
|
profilesService = input.profilesService
|
|
try
|
|
if InnertubeService.AuthRefreshAccessToken(accessTokenObject)
|
|
profileNode.expiresIn = accessTokenObject.expiresIn
|
|
profileNode.expiresTimestamp = accessTokenObject.expiresTimestamp
|
|
profileNode.accessToken = accessTokenObject.accessToken
|
|
profilesService@.SaveUserProfilesToRegistry()
|
|
else
|
|
LogError("Failed to refresh access token")
|
|
profileNode.accessToken = invalid
|
|
end if
|
|
catch error
|
|
LogError("Failed to refresh access token:", ErrorUtils.Format(error))
|
|
profileNode.accessToken = invalid
|
|
end try
|
|
|
|
return invalid
|
|
end function
|