0

I am working on an Angular project and have recently installed the Firebase Emulator.

I am trying to create an installation in Firebase.

Still, I am getting the error

'FirebaseError: Installations: Create Installation request failed with error "403 PERMISSION_DENIED: The caller does not have permission" (installations/request-failed)'

.

I have added the code:

app-module.ts

provideAuth(() => {
      const auth = getAuth();
      if (environment.useEmulators) {
        connectAuthEmulator(auth, 'http://localhost:9099');
      }
      return auth;
    }),

to the provided auth, but the error persists. What could be causing this issue, and how can I fix it?

Is there any configuration I need to do for Firebase Emulator and Angular project for a successful installation?

Thanks for the help in advance!

syahiruddin
  • 401
  • 5
  • 14
  • Possibly related: https://stackoverflow.com/questions/58495985/firebase-403-permission-denied-firebaseerror-installations-requests-are-blo – Chris Feb 02 '23 at 02:39

1 Answers1

0

This could be a conflict within your Firebase config when initializing the app:

const firebaseConfig = {
  apiKey: <API_KEY>,
  authDomain: '<projectId>.firebaseapp.com',
  projectId: '<fake-project-Id>',
  ...
};

In emulator you might be trying to use a fake projectId, however your remaining configuration are still pointing to your real project in Firebase.

To fix it, just use a different config for emulator:

if (environment.useEmulators) {
  firebaseConfig = {
    apiKey: <API_KEY>,
    authDomain: '<fake-project-Id>',
    projectId: '<fake-project-Id>',
    ...
  };
}