@@ -526,6 +526,18 @@ async function initializeFirebaseAdminStubs(frb: FunctionsRuntimeBundle): Promis
526
526
// Tell the Firebase Functions SDK to use the proxied app so that things like "change.after.ref"
527
527
// point to the right place.
528
528
localFunctionsModule . app . setEmulatedAdminApp ( defaultApp ) ;
529
+
530
+ // When the auth emulator is running, try to disable JWT verification.
531
+ if ( frb . emulators . auth ) {
532
+ const auth = defaultApp . auth ( ) ;
533
+ if ( typeof ( auth as any ) . setJwtVerificationEnabled === "function" ) {
534
+ logDebug ( "auth.setJwtVerificationEnabled(false)" , { } ) ;
535
+ ( auth as any ) . setJwtVerificationEnabled ( false ) ;
536
+ } else {
537
+ logDebug ( "auth.setJwtVerificationEnabled not available" , { } ) ;
538
+ }
539
+ }
540
+
529
541
return defaultApp ;
530
542
} )
531
543
. when ( "firestore" , ( target ) => {
@@ -677,6 +689,13 @@ async function initializeEnvironmentalVariables(frb: FunctionsRuntimeBundle): Pr
677
689
] = `${ frb . emulators . database . host } :${ frb . emulators . database . port } ` ;
678
690
}
679
691
692
+ // Make firebase-admin point at the Auth emulator
693
+ if ( frb . emulators . auth ) {
694
+ process . env [
695
+ Constants . FIREBASE_AUTH_EMULATOR_HOST
696
+ ] = `${ frb . emulators . auth . host } :${ frb . emulators . auth . port } ` ;
697
+ }
698
+
680
699
if ( frb . emulators . pubsub ) {
681
700
const pubsubHost = `${ frb . emulators . pubsub . host } :${ frb . emulators . pubsub . port } ` ;
682
701
process . env . PUBSUB_EMULATOR_HOST = pubsubHost ;
0 commit comments