Search code examples
angularfirebasefirebase-authenticationangularfire2angularfire

AngularFireAuth with SAMLAuthProvider does not accept provider parameter


I'm trying to use the firebase auth module with a Custom SAML Identity Provider, I was able to use it with the plain firebase SDK but I can not make it work with angular/fire/auth


import { Component, OnInit } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { auth } from 'firebase/app';

@Component({
  selector: 'app-mycomponent',
  templateUrl: './mycomponent.html',
  styleUrls: ['./mycomponent.css']
})
export class MyComponent implements OnInit {
  constructor( public afAuth: AngularFireAuth) { 
  }

  login(){
    this.afAuth.auth.signInWithRedirect(new auth.SAMLAuthProvider('saml.myProvider')); 
   //Error above : Expected 0 arguments, but got 1.ts(2554),

  }

//With Firebase SDK works this way
//firebase.auth().signInWithRedirect(new firebase.auth.SAMLAuthProvider('saml.myProvider'))

Solution

  • It's a typescript error that is reported, but you can still send in the parameter (in fact you have to for it to work) and it'll accept it at runtime.