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

Commit

Permalink
fix: add clientId to auth payload delivered by subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Dara Hayes committed May 16, 2019
1 parent 5136ac9 commit 5433079
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/auth/src/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export class Auth {
header: {
"Authorization": "Bearer " + this.auth.token
},
token: this.auth.token
token: this.auth.token,
clientId: this.internalConfig.clientId
});
} else {
reject("No keycloak token available");
Expand All @@ -146,4 +147,5 @@ export class Auth {
export interface AuthContext {
header: any;
token: string;
clientId: string;
}
1 change: 1 addition & 0 deletions packages/sync/src/auth/AuthContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
export interface AuthContext {
header: any;
token: string;
clientId: string;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/sync/src/links/WebsocketLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const defaultWebSocketLink = (userOptions: DataSyncConfig, config: WebSoc
// Params that can be used to send authentication token etc.
connectionParams: async () => {
if (userOptions.authContextProvider) {
const { header } = await userOptions.authContextProvider();
return { Authorization: header };
const { header, clientId } = await userOptions.authContextProvider();
return { ...header, clientId };
}
},
connectionCallback: options.connectionCallback,
Expand Down

0 comments on commit 5433079

Please sign in to comment.