mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-07 09:20:04 +01:00
token refresh bad requests are to be treated as unauthorized
This commit is contained in:
parent
4a0fc5ca0e
commit
b90ce2a2af
@ -4,7 +4,6 @@ using System.Threading.Tasks;
|
|||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Models.Api;
|
using Bit.App.Models.Api;
|
||||||
using Plugin.Connectivity.Abstractions;
|
using Plugin.Connectivity.Abstractions;
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace Bit.App.Repositories
|
namespace Bit.App.Repositories
|
||||||
{
|
{
|
||||||
|
@ -75,6 +75,11 @@ namespace Bit.App.Repositories
|
|||||||
var response = await client.SendAsync(requestMessage).ConfigureAwait(false);
|
var response = await client.SendAsync(requestMessage).ConfigureAwait(false);
|
||||||
if(!response.IsSuccessStatusCode)
|
if(!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
|
if(response.StatusCode == HttpStatusCode.BadRequest)
|
||||||
|
{
|
||||||
|
response.StatusCode = HttpStatusCode.Unauthorized;
|
||||||
|
}
|
||||||
|
|
||||||
return await error.Invoke(response).ConfigureAwait(false);
|
return await error.Invoke(response).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +116,11 @@ namespace Bit.App.Repositories
|
|||||||
var response = await client.SendAsync(requestMessage).ConfigureAwait(false);
|
var response = await client.SendAsync(requestMessage).ConfigureAwait(false);
|
||||||
if(!response.IsSuccessStatusCode)
|
if(!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
|
if(response.StatusCode == HttpStatusCode.BadRequest)
|
||||||
|
{
|
||||||
|
response.StatusCode = HttpStatusCode.Unauthorized;
|
||||||
|
}
|
||||||
|
|
||||||
return await error.Invoke(response).ConfigureAwait(false);
|
return await error.Invoke(response).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +129,7 @@ namespace Bit.App.Repositories
|
|||||||
TokenService.Token = tokenResponse.AccessToken;
|
TokenService.Token = tokenResponse.AccessToken;
|
||||||
TokenService.RefreshToken = tokenResponse.RefreshToken;
|
TokenService.RefreshToken = tokenResponse.RefreshToken;
|
||||||
}
|
}
|
||||||
catch(Exception ee)
|
catch
|
||||||
{
|
{
|
||||||
return webException.Invoke();
|
return webException.Invoke();
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Models.Api;
|
using Bit.App.Models.Api;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Plugin.Connectivity.Abstractions;
|
using Plugin.Connectivity.Abstractions;
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace Bit.App.Repositories
|
namespace Bit.App.Repositories
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Models.Api;
|
using Bit.App.Models.Api;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Plugin.Connectivity.Abstractions;
|
using Plugin.Connectivity.Abstractions;
|
||||||
|
|
||||||
namespace Bit.App.Repositories
|
namespace Bit.App.Repositories
|
||||||
|
Loading…
Reference in New Issue
Block a user