From ec488e4f847f1d476e4f95f01d711e6207e334a6 Mon Sep 17 00:00:00 2001 From: Todd Martin <106564991+trmartin4@users.noreply.github.com> Date: Thu, 27 Feb 2025 10:00:52 -0500 Subject: [PATCH] [PM-18664] Prevent display of Auth Request notification on triggering device (#13597) * Send device identifier in header. * Added null to apiUrl property for strict typing. * Added null to apiUrl for strict typing. --- .../auth-request/auth-request-api.service.ts | 15 ++++++++++++++- libs/common/src/abstractions/api.service.ts | 2 +- libs/common/src/services/api.service.ts | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libs/auth/src/common/services/auth-request/auth-request-api.service.ts b/libs/auth/src/common/services/auth-request/auth-request-api.service.ts index b5fc72588a..c9fec1400c 100644 --- a/libs/auth/src/common/services/auth-request/auth-request-api.service.ts +++ b/libs/auth/src/common/services/auth-request/auth-request-api.service.ts @@ -54,7 +54,20 @@ export class DefaultAuthRequestApiService implements AuthRequestApiService { async postAuthRequest(request: AuthRequest): Promise { 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) { diff --git a/libs/common/src/abstractions/api.service.ts b/libs/common/src/abstractions/api.service.ts index 5bd2221860..fe3f356719 100644 --- a/libs/common/src/abstractions/api.service.ts +++ b/libs/common/src/abstractions/api.service.ts @@ -142,7 +142,7 @@ export abstract class ApiService { body: any, authed: boolean, hasResponse: boolean, - apiUrl?: string, + apiUrl?: string | null, alterHeaders?: (headers: Headers) => void, ) => Promise; diff --git a/libs/common/src/services/api.service.ts b/libs/common/src/services/api.service.ts index ad59ad0837..6d90f2ac25 100644 --- a/libs/common/src/services/api.service.ts +++ b/libs/common/src/services/api.service.ts @@ -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 { const env = await firstValueFrom(this.environmentService.environment$);