mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-19 01:51:27 +01:00
make src/services/api.service.ts work with https servers requiring client certificates. (#4)
This commit is contained in:
parent
d3f3f47286
commit
4c8f9c6b7c
@ -76,6 +76,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(this.platformUtilsService.identityClientId)),
|
||||
credentials: 'include',
|
||||
cache: 'no-cache',
|
||||
headers: new Headers({
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
||||
@ -118,6 +119,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const response = await fetch(new Request(this.baseUrl + '/two-factor/send-email-login', {
|
||||
body: JSON.stringify(request),
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
'Device-Type': this.deviceType,
|
||||
@ -157,6 +159,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const authHeader = await this.handleTokenState();
|
||||
const response = await fetch(new Request(this.baseUrl + '/accounts/revision-date', {
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Accept': 'application/json',
|
||||
'Authorization': authHeader,
|
||||
@ -176,6 +179,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const response = await fetch(new Request(this.baseUrl + '/accounts/password-hint', {
|
||||
body: JSON.stringify(request),
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
'Device-Type': this.deviceType,
|
||||
@ -193,6 +197,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const response = await fetch(new Request(this.baseUrl + '/accounts/register', {
|
||||
body: JSON.stringify(request),
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
'Device-Type': this.deviceType,
|
||||
@ -213,6 +218,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const response = await fetch(new Request(this.baseUrl + '/folders', {
|
||||
body: JSON.stringify(request),
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Accept': 'application/json',
|
||||
'Authorization': authHeader,
|
||||
@ -236,6 +242,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const response = await fetch(new Request(this.baseUrl + '/folders/' + id, {
|
||||
body: JSON.stringify(request),
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Accept': 'application/json',
|
||||
'Authorization': authHeader,
|
||||
@ -258,6 +265,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const authHeader = await this.handleTokenState();
|
||||
const response = await fetch(new Request(this.baseUrl + '/folders/' + id, {
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Authorization': authHeader,
|
||||
'Device-Type': this.deviceType,
|
||||
@ -278,6 +286,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const response = await fetch(new Request(this.baseUrl + '/ciphers', {
|
||||
body: JSON.stringify(request),
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Accept': 'application/json',
|
||||
'Authorization': authHeader,
|
||||
@ -301,6 +310,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id, {
|
||||
body: JSON.stringify(request),
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Accept': 'application/json',
|
||||
'Authorization': authHeader,
|
||||
@ -323,6 +333,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const authHeader = await this.handleTokenState();
|
||||
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id, {
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Authorization': authHeader,
|
||||
'Device-Type': this.deviceType,
|
||||
@ -343,6 +354,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id + '/attachment', {
|
||||
body: data,
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Accept': 'application/json',
|
||||
'Authorization': authHeader,
|
||||
@ -364,6 +376,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const authHeader = await this.handleTokenState();
|
||||
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id + '/attachment/' + attachmentId, {
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Authorization': authHeader,
|
||||
'Device-Type': this.deviceType,
|
||||
@ -383,6 +396,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
const authHeader = await this.handleTokenState();
|
||||
const response = await fetch(new Request(this.baseUrl + '/sync', {
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Accept': 'application/json',
|
||||
'Authorization': authHeader,
|
||||
@ -460,6 +474,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
refresh_token: refreshToken,
|
||||
}),
|
||||
cache: 'no-cache',
|
||||
credentials: 'include',
|
||||
headers: new Headers({
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
||||
'Accept': 'application/json',
|
||||
|
Loading…
Reference in New Issue
Block a user