mirror of
https://github.com/bitwarden/mobile
synced 2025-12-16 00:03:22 +00:00
Converted auth to identity server endpoints and utilize bearer2 access token
This commit is contained in:
@@ -1,9 +1,41 @@
|
||||
namespace Bit.App.Models.Api
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bit.App.Models.Api
|
||||
{
|
||||
public class TokenRequest
|
||||
{
|
||||
public string Email { get; set; }
|
||||
public string MasterPasswordHash { get; set; }
|
||||
public string Token { get; set; }
|
||||
public int? Provider { get; set; }
|
||||
public DeviceRequest Device { get; set; }
|
||||
|
||||
public IDictionary<string, string> ToIdentityTokenRequest()
|
||||
{
|
||||
var dict = new Dictionary<string, string>
|
||||
{
|
||||
{ "grant_type", "password" },
|
||||
{ "username", Email },
|
||||
{ "password", MasterPasswordHash },
|
||||
{ "scope", "api offline_access" },
|
||||
{ "client_id", "mobile" }
|
||||
};
|
||||
|
||||
if(Device != null)
|
||||
{
|
||||
dict.Add("DeviceType", Device.Type.ToString());
|
||||
dict.Add("DeviceIdentifier", Device.Identifier);
|
||||
dict.Add("DeviceName", Device.Name);
|
||||
dict.Add("DevicePushToken", Device.PushToken);
|
||||
}
|
||||
|
||||
if(Token != null && Provider.HasValue)
|
||||
{
|
||||
dict.Add("TwoFactorToken", Token);
|
||||
dict.Add("TwoFactorProvider", Provider.Value.ToString());
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user