angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Firebase authentication methods "Anonymous", "Custom", "Password" not working

Open aashirwadgupta opened this issue 10 years ago • 4 comments

Hi Team, I am trying to use Custom authentication/Anonymous/Email&Password authentication strategies to get a user login in to my app but the thing is just not working. Do I need to configure something inside my firebase database apart from what firebase docs says.

I am using visual studio. Here is my main.ts import { bootstrap } from '@angular/platform-browser-dynamic'; import {AppComponent} from './app.component'; import {ROUTER_PROVIDERS} from '@angular/router-deprecated'; import {FIREBASE_PROVIDERS,defaultFirebase, firebaseAuthConfig, AuthMethods, AuthProviders} from 'angularfire2';

bootstrap(AppComponent, [ ROUTER_PROVIDERS, FIREBASE_PROVIDERS, defaultFirebase("https://.firebaseio.com/"), firebaseAuthConfig({ method: AuthMethods.Popup, provider: AuthProviders.Anonymous }) ]); Below is the snippet of the console error I am getting in chrome image

NOTE: I have not deployed app on the firebase, I am running in local

aashirwadgupta avatar May 11 '16 02:05 aashirwadgupta

Hi @aashirwadgupta, have you already enabled the anonymous authentication in your firebase db? Go to your Firebase "Dashboard", "Login & Auth" and check if the " Enable Anonymous User Authentication" checkbox in the "Anonymous" tab is already checked.

kazkis avatar May 11 '16 08:05 kazkis

Hi @kazkis Yes I have enabled the anonymous authentication but the rules are still default to read and write true for all users. This is how it looks now image

aashirwadgupta avatar May 11 '16 10:05 aashirwadgupta

Hey @aashirwadgupta!

You can't mix AuthMethods.Popup with AuthProviders.Anonymous. The correct combination uses both AuthProviders.Anonymous and AuthMethods.Anonymous. This is because there is no popup mechanism for anonymous authentication.

bootstrap(AppComponent, [
  ROUTER_PROVIDERS,
  FIREBASE_PROVIDERS,
  defaultFirebase("https://.firebaseio.com/"),
  firebaseAuthConfig({
    method: AuthMethods.Anonymous,
    provider: AuthProviders.Anonymous
  })
]);

We should however look into creating errors for invalid combinations like we do with queries.

davideast avatar May 11 '16 15:05 davideast

Thanks a lot for pointing that out.

aashirwadgupta avatar May 11 '16 16:05 aashirwadgupta