mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-27 17:18:04 +01:00
platform specific identity client id
This commit is contained in:
parent
e27df6bc09
commit
0b57d8b7f3
@ -1,6 +1,7 @@
|
||||
import { DeviceType } from '../enums/deviceType';
|
||||
|
||||
export abstract class PlatformUtilsService {
|
||||
identityClientId: string;
|
||||
getDevice: () => DeviceType;
|
||||
getDeviceString: () => string;
|
||||
isFirefox: () => boolean;
|
||||
|
@ -18,13 +18,13 @@ export class TokenRequest {
|
||||
this.device = device != null ? device : null;
|
||||
}
|
||||
|
||||
toIdentityToken() {
|
||||
toIdentityToken(clientId: string) {
|
||||
const obj: any = {
|
||||
grant_type: 'password',
|
||||
username: this.email,
|
||||
password: this.masterPasswordHash,
|
||||
scope: 'api offline_access',
|
||||
client_id: 'browser',
|
||||
client_id: clientId,
|
||||
};
|
||||
|
||||
if (this.device) {
|
||||
|
@ -27,7 +27,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
deviceType: string;
|
||||
logoutCallback: Function;
|
||||
|
||||
constructor(private tokenService: TokenService, platformUtilsService: PlatformUtilsService,
|
||||
constructor(private tokenService: TokenService, private platformUtilsService: PlatformUtilsService,
|
||||
logoutCallback: Function) {
|
||||
this.logoutCallback = logoutCallback;
|
||||
this.deviceType = platformUtilsService.getDevice().toString();
|
||||
@ -75,7 +75,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
|
||||
async postIdentityToken(request: TokenRequest): Promise<IdentityTokenResponse | IdentityTwoFactorResponse> {
|
||||
const response = await fetch(new Request(this.identityBaseUrl + '/connect/token', {
|
||||
body: this.qsStringify(request.toIdentityToken()),
|
||||
body: this.qsStringify(request.toIdentityToken(this.platformUtilsService.identityClientId)),
|
||||
cache: 'no-cache',
|
||||
headers: new Headers({
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
||||
|
Loading…
Reference in New Issue
Block a user