File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ export class WebChannelConnection extends RestConnection {
7272 url : string ,
7373 headers : StringMap ,
7474 body : Req ,
75- _isUsingEmulator : boolean
75+ _forwardCredentials : boolean
7676 ) : Promise < Resp > {
7777 const streamId = generateUniqueDebugId ( ) ;
7878 return new Promise ( ( resolve : Resolver < Resp > , reject : Rejecter ) => {
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export class FetchConnection extends RestConnection {
4141 url : string ,
4242 headers : StringMap ,
4343 body : Req ,
44- isUsingEmulator : boolean
44+ forwardCredentials : boolean
4545 ) : Promise < Resp > {
4646 const requestJson = JSON . stringify ( body ) ;
4747 let response : Response ;
@@ -52,7 +52,7 @@ export class FetchConnection extends RestConnection {
5252 headers,
5353 body : requestJson
5454 } ;
55- if ( isCloudWorkstation ( new URL ( url ) . host ) && isUsingEmulator ) {
55+ if ( forwardCredentials ) {
5656 fetchArgs . credentials = 'include' ;
5757 }
5858 response = await fetch ( url , fetchArgs ) ;
Original file line number Diff line number Diff line change 1515 * limitations under the License.
1616 */
1717
18+ import { isCloudWorkstation } from '@firebase/util' ;
1819import { SDK_VERSION } from '../../src/core/version' ;
1920import { Token } from '../api/credentials' ;
2021import {
@@ -98,12 +99,15 @@ export abstract class RestConnection implements Connection {
9899 } ;
99100 this . modifyHeadersForRequest ( headers , authToken , appCheckToken ) ;
100101
102+ const { host } = new URL ( url ) ;
103+ const forwardCredentials =
104+ isCloudWorkstation ( host ) && this . databaseInfo . isUsingEmulator ;
101105 return this . performRPCRequest < Req , Resp > (
102106 rpcName ,
103107 url ,
104108 headers ,
105109 req ,
106- this . databaseInfo . isUsingEmulator
110+ forwardCredentials
107111 ) . then (
108112 response => {
109113 logDebug ( LOG_TAG , `Received RPC '${ rpcName } ' ${ streamId } : ` , response ) ;
@@ -186,7 +190,7 @@ export abstract class RestConnection implements Connection {
186190 url : string ,
187191 headers : StringMap ,
188192 body : Req ,
189- isUsingEmulator : boolean
193+ _forwardCredentials : boolean
190194 ) : Promise < Resp > ;
191195
192196 private makeUrl ( rpcName : string , path : string ) : string {
You can’t perform that action at this time.
0 commit comments