mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-28 03:21:40 +01:00
[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.
This commit is contained in:
parent
182ff6481d
commit
ec488e4f84
@ -54,7 +54,20 @@ export class DefaultAuthRequestApiService implements AuthRequestApiService {
|
|||||||
|
|
||||||
async postAuthRequest(request: AuthRequest): Promise<AuthRequestResponse> {
|
async postAuthRequest(request: AuthRequest): Promise<AuthRequestResponse> {
|
||||||
try {
|
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);
|
return new AuthRequestResponse(response);
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
|
@ -142,7 +142,7 @@ export abstract class ApiService {
|
|||||||
body: any,
|
body: any,
|
||||||
authed: boolean,
|
authed: boolean,
|
||||||
hasResponse: boolean,
|
hasResponse: boolean,
|
||||||
apiUrl?: string,
|
apiUrl?: string | null,
|
||||||
alterHeaders?: (headers: Headers) => void,
|
alterHeaders?: (headers: Headers) => void,
|
||||||
) => Promise<any>;
|
) => Promise<any>;
|
||||||
|
|
||||||
|
@ -1863,7 +1863,7 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
body: any,
|
body: any,
|
||||||
authed: boolean,
|
authed: boolean,
|
||||||
hasResponse: boolean,
|
hasResponse: boolean,
|
||||||
apiUrl?: string,
|
apiUrl?: string | null,
|
||||||
alterHeaders?: (headers: Headers) => void,
|
alterHeaders?: (headers: Headers) => void,
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const env = await firstValueFrom(this.environmentService.environment$);
|
const env = await firstValueFrom(this.environmentService.environment$);
|
||||||
|
Loading…
Reference in New Issue
Block a user