Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
platform specific identity client id
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Mar 21, 2018
1 parent e27df6b commit 0b57d8b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/abstractions/platformUtils.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DeviceType } from '../enums/deviceType';

export abstract class PlatformUtilsService {
identityClientId: string;
getDevice: () => DeviceType;
getDeviceString: () => string;
isFirefox: () => boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/models/request/tokenRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 0b57d8b

Please sign in to comment.