mirror of
https://github.com/ppy/osu
synced 2025-02-17 02:47:19 +00:00
Fix authentication loss not handled correctly
This handles the case where on initial API connection, the server
responds with an `Unauthorized` response. It doesn't perform this same
checking/handling on every API request, which is probably what we want
eventually.
Opting to not address the full issue because I know this is going to be
a long one (see
05c50c0f6c/osu.Game/Online/API/APIAccess.cs (L233)
).
This commit is contained in:
parent
05c50c0f6c
commit
17168b8137
@ -148,6 +148,16 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
var userReq = new GetUserRequest();
|
var userReq = new GetUserRequest();
|
||||||
|
|
||||||
|
userReq.Failure += ex =>
|
||||||
|
{
|
||||||
|
if (ex.InnerException is WebException webException && webException.Message == @"Unauthorized")
|
||||||
|
{
|
||||||
|
log.Add(@"Login no longer valid");
|
||||||
|
Logout();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
failConnectionProcess();
|
||||||
|
};
|
||||||
userReq.Success += u =>
|
userReq.Success += u =>
|
||||||
{
|
{
|
||||||
localUser.Value = u;
|
localUser.Value = u;
|
||||||
@ -167,6 +177,7 @@ namespace osu.Game.Online.API
|
|||||||
// getting user's friends is considered part of the connection process.
|
// getting user's friends is considered part of the connection process.
|
||||||
var friendsReq = new GetFriendsRequest();
|
var friendsReq = new GetFriendsRequest();
|
||||||
|
|
||||||
|
friendsReq.Failure += _ => failConnectionProcess();
|
||||||
friendsReq.Success += res =>
|
friendsReq.Success += res =>
|
||||||
{
|
{
|
||||||
friends.AddRange(res);
|
friends.AddRange(res);
|
||||||
|
Loading…
Reference in New Issue
Block a user