Skip to content

Commit

Permalink
[PM-18664] Prevent display of Auth Request notification on triggering…
Browse files Browse the repository at this point in the history
… device (#13597)

* Send device identifier in header.

* Added null to apiUrl property for strict typing.

* Added null to apiUrl for strict typing.
  • Loading branch information
trmartin4 authored Feb 27, 2025
1 parent 182ff64 commit ec488e4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@ export class DefaultAuthRequestApiService implements AuthRequestApiService {

async postAuthRequest(request: AuthRequest): Promise<AuthRequestResponse> {
try {
const response = await this.apiService.send("POST", "/auth-requests/", request, false, true);
// Submit the current device identifier in the header as well as in the POST body.
// The value in the header will be used to build the request context and ensure that the resulting
// notifications have the current device as a source.
const response = await this.apiService.send(
"POST",
"/auth-requests/",
request,
false,
true,
null,
(headers) => {
headers.set("Device-Identifier", request.deviceIdentifier);
},
);

return new AuthRequestResponse(response);
} catch (e: unknown) {
Expand Down
2 changes: 1 addition & 1 deletion libs/common/src/abstractions/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export abstract class ApiService {
body: any,
authed: boolean,
hasResponse: boolean,
apiUrl?: string,
apiUrl?: string | null,
alterHeaders?: (headers: Headers) => void,
) => Promise<any>;

Expand Down
2 changes: 1 addition & 1 deletion libs/common/src/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,7 @@ export class ApiService implements ApiServiceAbstraction {
body: any,
authed: boolean,
hasResponse: boolean,
apiUrl?: string,
apiUrl?: string | null,
alterHeaders?: (headers: Headers) => void,
): Promise<any> {
const env = await firstValueFrom(this.environmentService.environment$);
Expand Down

0 comments on commit ec488e4

Please sign in to comment.