mirror of
https://github.com/bitwarden/mobile
synced 2025-12-15 15:53:44 +00:00
Client & Version headers (#1757)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Domain;
|
||||
using Bit.Core.Models.Request;
|
||||
@@ -37,6 +38,8 @@ namespace Bit.Core.Services
|
||||
_logoutCallbackAsync = logoutCallbackAsync;
|
||||
var device = (int)_platformUtilsService.GetDevice();
|
||||
_httpClient.DefaultRequestHeaders.Add("Device-Type", device.ToString());
|
||||
_httpClient.DefaultRequestHeaders.Add("Bitwarden-Client-Name", _platformUtilsService.GetClientType().GetString());
|
||||
_httpClient.DefaultRequestHeaders.Add("Bitwarden-Client-Version", _platformUtilsService.GetApplicationVersion());
|
||||
if (!string.IsNullOrWhiteSpace(customUserAgent))
|
||||
{
|
||||
_httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(customUserAgent);
|
||||
@@ -87,7 +90,7 @@ namespace Bit.Core.Services
|
||||
Version = new Version(1, 0),
|
||||
RequestUri = new Uri(string.Concat(IdentityBaseUrl, "/connect/token")),
|
||||
Method = HttpMethod.Post,
|
||||
Content = new FormUrlEncodedContent(request.ToIdentityToken(_platformUtilsService.IdentityClientId))
|
||||
Content = new FormUrlEncodedContent(request.ToIdentityToken(_platformUtilsService.GetClientType().GetString()))
|
||||
};
|
||||
requestMessage.Headers.Add("Accept", "application/json");
|
||||
request.AlterIdentityTokenHeaders(requestMessage.Headers);
|
||||
|
||||
Reference in New Issue
Block a user