No provider for injectionToken Firebase App Config Token!

has anyone come across this:

error no provider for injectionToken Firebase App Config Token!

I know it is something to do with the firebase version but I have changed and changed and still having no luck.

Impossible to diagnose without knowing what you are dealing with.

Sorry, I have changed the firebase version from older versions to 4.8.0 then to 4.8.1, but still had no luck

If you’re using AF2, don’t use 4.8.1. Beyond that, your imports and constructors might be an issue.

I am currently using version 4.8.0

My imports set up, I am not sure if it something around that area?

@NgModule({
declarations: [ //page declarations
MyApp,

],
imports: [
BrowserModule, //the Imports that I have used
HttpModule,
AngularFireDatabaseModule,
IonicModule.forRoot(MyApp),
AngularFireAuthModule,
OpenWeatherMapModule

You have to run the AF2 initializeApp function before you import the database or auth modules. Check the sample code on the AF2 installation page.,

To match the following?

imports: [
BrowserModule, //the Imports that I have used
IonicModule.forRoot(MyApp),
HttpModule,
AngularFireDatabaseModule,
AngularFireAuthModule,
OpenWeatherMapModule

I still don’t see the words initializeApp in there.

imports: [
BrowserModule, //the Imports that I have used
AngularFireModule.initializeApp(firebaseConfig),
IonicModule.forRoot(MyApp),
HttpModule,
AngularFireDatabaseModule,
AngularFireAuthModule,
OpenWeatherMapModule

I tried this yesterday but still getting the same error

The InjectionToken is defined in the initializeApp method of firebase.app.module.ts. You can read the code yourself. If you did that and still got an error, it was a different error. You might remember it as the same, but it wasn’t.

1 Like

Hi Aaron thanks for the help, I am still struggling but I’ll have to figure it out

Go to Firebase console online. Go to your project settings. Choose the web option under the “add app” selections. A script will pop up. You need to follow the directions that appear. You’ll end up with a variable that needs to be pasted into app.module.ts that goes by the name of config, FirebaseConfig, or whatever you want. Then

Also add the script tag that imports Firebase.js to your index.html. That is also included in that pop up found in Firebase console of your project

The script that contains your config settings needs to be have the script tag removed and replaced as a variable declaration. Use const or let. Not var.

I had that and it did work but I have tried to implement this tutorial https://javebratt.com/ionic-firebase-authentication/

I don’t know if you have seen this?

I have (good tutorial). I’ve encountered that error before, but don’t recall the fix at the moment. If it comes to mind you’ll be the first to know. Happy hunting

I have managed to fix it

have you put this code ?

export const firebaseConfig = {
    apiKey: "",
    authDomain: "",
    databaseURL: "",
    projectId: "",
    storageBucket: ",
    messagingSenderId: ""
}
1 Like

Yes I have got it all working, it was the initiliiase app method was in the wrong place.

Out of curiosity, where’d you have it that made it spawn an error?

If it helped dont forget to mark it as solution! Glad it worked