From 0b57d8b7f368ba4e90fe13ef8bf6662f3cfdd820 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 21 Mar 2018 11:19:05 -0400 Subject: [PATCH] platform specific identity client id --- src/abstractions/platformUtils.service.ts | 1 + src/models/request/tokenRequest.ts | 4 ++-- src/services/api.service.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/abstractions/platformUtils.service.ts b/src/abstractions/platformUtils.service.ts index 5ed47ede54..05bbfaab7d 100644 --- a/src/abstractions/platformUtils.service.ts +++ b/src/abstractions/platformUtils.service.ts @@ -1,6 +1,7 @@ import { DeviceType } from '../enums/deviceType'; export abstract class PlatformUtilsService { + identityClientId: string; getDevice: () => DeviceType; getDeviceString: () => string; isFirefox: () => boolean; diff --git a/src/models/request/tokenRequest.ts b/src/models/request/tokenRequest.ts index 6cce0f23b0..4588903241 100644 --- a/src/models/request/tokenRequest.ts +++ b/src/models/request/tokenRequest.ts @@ -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) { diff --git a/src/services/api.service.ts b/src/services/api.service.ts index 1e452af755..cc30228899 100644 --- a/src/services/api.service.ts +++ b/src/services/api.service.ts @@ -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 { 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',