SAMLAuthProvider class

An AuthProvider for SAML.

Signature:

export declare class SAMLAuthProvider extends FederatedAuthProvider 

Extends: FederatedAuthProvider

Constructors

Constructor Modifiers Description
(constructor)(providerId) Constructor. The providerId must start with "saml."

Methods

Method Modifiers Description
credentialFromError(error) static Used to extract the underlying OAuthCredential from a AuthError which was thrown during a sign-in, link, or reauthenticate operation.
credentialFromJSON(json) static Creates an AuthCredential from a JSON string or a plain object.
credentialFromResult(userCredential) static Generates an AuthCredential from a UserCredential after a successful SAML flow completes.

SAMLAuthProvider.(constructor)

Constructor. The providerId must start with "saml."

Signature:

constructor(providerId: string);

Parameters

Parameter Type Description
providerId string SAML provider ID.

SAMLAuthProvider.credentialFromError()

Used to extract the underlying OAuthCredential from a AuthError which was thrown during a sign-in, link, or reauthenticate operation.

Signature:

static credentialFromError(error: FirebaseError): AuthCredential | null;

Parameters

Parameter Type Description
error FirebaseError

Returns:

AuthCredential | null

SAMLAuthProvider.credentialFromJSON()

Creates an AuthCredential from a JSON string or a plain object.

Signature:

static credentialFromJSON(json: string | object): AuthCredential;

Parameters

Parameter Type Description
json string | object A plain object or a JSON string

Returns:

AuthCredential

SAMLAuthProvider.credentialFromResult()

Generates an AuthCredential from a UserCredential after a successful SAML flow completes.

For example, to get an AuthCredential, you could write the following code:

const userCredential = await signInWithPopup(auth, samlProvider);
const credential = SAMLAuthProvider.credentialFromResult(userCredential);

Signature:

static credentialFromResult(userCredential: UserCredential): AuthCredential | null;

Parameters

Parameter Type Description
userCredential UserCredential The user credential.

Returns:

AuthCredential | null