Skip to content

Auth docs don't demonstrate where to get AuthProviders, AuthMethods #627

@Splaktar

Description

@Splaktar

On first reading the Auth docs while doing the RC.4 to 2.1.0 upgrade and coming from angularfire2 beta.2 to beta.5, it was confusing if there was some new way to getting AuthProviders and AuthMethods. I was wondering if these come from the AngularFireModule now or if they came from a service or something. It would have saved me a lot of confusion to just specify that that they are still imported from angularfire2 like before. I.e. import { AngularFireModule, AuthProviders, AuthMethods } from 'angularfire2';

https://github.com/angular/angularfire2/blob/master/docs/5-user-authentication.md

Currently:

const myFirebaseConfig = {
  apiKey: '<your-key>',
  authDomain: '<your-project-authdomain>',
  databaseURL: '<your-database-URL>',
  storageBucket: '<your-storage-bucket>',
}

const myFirebaseAuthConfig = {
  provider: AuthProviders.Google,
  method: AuthMethods.Redirect
}

@NgModule({
  imports: [
    BrowserModule,
    AngularFireModule.initializeApp(myFirebaseConfig, myFirebaseAuthConfig)
  ],
  declarations: [ MyComponent ],
  boostrap: [ MyComponent ]
})
export class MyAppModule {}

It would be less confusing as:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularFireModule, AuthProviders, AuthMethods } from 'angularfire2';

const myFirebaseConfig = {
  apiKey: '<your-key>',
  authDomain: '<your-project-authdomain>',
  databaseURL: '<your-database-URL>',
  storageBucket: '<your-storage-bucket>',
}

const myFirebaseAuthConfig = {
  provider: AuthProviders.Google,
  method: AuthMethods.Redirect
}

@NgModule({
  imports: [
    BrowserModule,
    AngularFireModule.initializeApp(myFirebaseConfig, myFirebaseAuthConfig)
  ],
  declarations: [ AppComponent ],
  bootstrap: [ AppComponent ]
})
export class AppModule {}

The other doc examples use AppModule and AppComponent instead of MyComponent and MyAppModule as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions