diff --git a/src/Core/Models/TokenRequest.cs b/src/Core/Models/TokenRequest.cs index 46bff3a7..e53584aa 100644 --- a/src/Core/Models/TokenRequest.cs +++ b/src/Core/Models/TokenRequest.cs @@ -18,7 +18,7 @@ namespace Bit.Core.Models { "username", Email }, { "password", MasterPasswordHash }, { "scope", "api offline_access" }, - { "client_id", "mobile" } + { "client_id", "connector" } }; if(Token != null && Provider.HasValue) diff --git a/src/Core/Services/ApiService.cs b/src/Core/Services/ApiService.cs index 35c2045d..c710c832 100644 --- a/src/Core/Services/ApiService.cs +++ b/src/Core/Services/ApiService.cs @@ -16,10 +16,20 @@ namespace Bit.Core.Services private ApiService() { ApiClient = new HttpClient(); - ApiClient.BaseAddress = new Uri("https://api.bitwarden.com"); + var apiUrl = "https://api.bitwarden.com"; + if(!string.IsNullOrWhiteSpace(SettingsService.Instance.ApiBaseUrl)) + { + apiUrl = SettingsService.Instance.ApiBaseUrl; + } + ApiClient.BaseAddress = new Uri(apiUrl); IdentityClient = new HttpClient(); - IdentityClient.BaseAddress = new Uri("https://identity.bitwarden.com"); + var identityUrl = "https://identity.bitwarden.com"; + if(!string.IsNullOrWhiteSpace(SettingsService.Instance.IdentityBaseUrl)) + { + identityUrl = SettingsService.Instance.IdentityBaseUrl; + } + IdentityClient.BaseAddress = new Uri(identityUrl); } public static ApiService Instance diff --git a/src/Core/Services/SettingsService.cs b/src/Core/Services/SettingsService.cs index e8eb519e..892f7793 100644 --- a/src/Core/Services/SettingsService.cs +++ b/src/Core/Services/SettingsService.cs @@ -75,6 +75,32 @@ namespace Bit.Core.Services } } + public string ApiBaseUrl + { + get + { + return Settings.ApiBaseUrl; + } + set + { + Settings.ApiBaseUrl = value; + SaveSettings(); + } + } + + public string IdentityBaseUrl + { + get + { + return Settings.IdentityBaseUrl; + } + set + { + Settings.IdentityBaseUrl = value; + SaveSettings(); + } + } + public EncryptedData AccessToken { get @@ -116,6 +142,8 @@ namespace Bit.Core.Services public class SettingsModel { + public string ApiBaseUrl { get; set; } + public string IdentityBaseUrl { get; set; } public EncryptedData AccessToken { get; set; } public EncryptedData RefreshToken { get; set; } public ServerConfiguration Server { get; set; }