Packagecom.myflashlab.air.extensions.firebase.auth
Classpublic class Auth
InheritanceAuth Inheritance Object

The entry point of the Firebase Authentication SDK.



Public Properties
 PropertyDefined By
  isLoggin : Boolean
[static] [read-only]
Auth
  isPhoneVerificationInProgress : Boolean
[static] [read-only]
Auth
  languageCode : String
[static] user-facing language code for auth operations that can be internationalized, such as sendEmailVerification().
Auth
  listener : EventDispatcher
[static] [read-only]
Auth
Public Methods
 MethodDefined By
  
applyActionCode($code:String):void
[static] Applies out of band code.
Auth
  
checkActionCode($code:String):void
[static] Checks the validity of an out of band code.
Auth
  
confirmPasswordResetWithCode($code:String, $newPassword:String):void
[static] Resets the password given a code sent to the user outside of the app and a new password for the user.
Auth
  
createUserWithEmailAndPassword($email:String, $password:String):void
[static] Tries to create a new user account with the given email address and password.
Auth
  
fetchProvidersForEmail($emailAddress:String, $callback:Function):void
[static] Deprecated, use fetchSignInMethodsForEmail instead.
Auth
  
fetchSignInMethodsForEmail($emailAddress:String, $callback:Function):void
[static] Returns a list of signin methods that can be used to sign in a given user (identified by its main email address).
Auth
  
init():void
[static] Call this method prior to any other Auth methods.
Auth
  
isSignInWithEmailLink($link:String):Boolean
[static]
Auth
  
reVerifyPhoneNumber($phoneNumber:String):void
[static] Android only If your app is closed before the phone auth progress is finished, you should use this method to get back in the progress.
Auth
  
sendPasswordResetEmail($emailAddress:String, $actionCodeSettings:ActionCodeSettings = null):void
[static] Triggers the Firebase Authentication backend to send a password-reset email to the given email address, which must correspond to an existing user of your app.
Auth
  
sendSignInLinkToEmail($emailAddress:String, $actionCodeSettings:ActionCodeSettings):void
[static] Sends an email to the specified email which will contain a link to be used to sign in the user.
Auth
  
signIn($credential:Object = null):void
[static] Tries to sign in a user with the given credential info.
Auth
  
signInWithCustomToken($token:String):void
[static] Asynchronously signs in to Firebase with the given Auth token.
Auth
  
signInWithEmail($email:String, $pass:String):void
[static] Deprecated, use signInWithEmailPass instead.
Auth
  
signInWithEmailLink($email:String, $link:String):void
[static] Tries to sign in a user with the given email address and link.
Auth
  
signInWithEmailPass($email:String, $pass:String):void
[static] Signs in using an email address and password.
Auth
  
signOut():void
[static] Signs out the current user and clears it from the disk cache.
Auth
  
[static] Sets the user-facing language code to be the default app language.
Auth
  
verifyPasswordResetCode($code:String):void
[static] Checks the validity of a verify password reset code.
Auth
  
verifyPhoneNumber($phoneNumber:String):void
[static] Starts the phone number verification process for the given phone number.
Auth
Public Constants
 ConstantDefined By
  ACTION_CODE_OPERATION_PASSWORD_RESET : int = 1
[static] Action code for password reset operation
Auth
  ACTION_CODE_OPERATION_UNKNOWN : int = 0
[static] Action code for unknown operation
Auth
  ACTION_CODE_OPERATION_VERIFY_EMAIL : int = 2
[static] Action code for verify email operation
Auth
  EXTENSION_ID : String = com.myflashlab.air.extensions.firebase.auth
[static]
Auth
  RESULT_AUTH_EMAIL_EXCEPTION : int = 7
[static] Represents the exception which is a result of an attempt to send an email via Firebase Auth (e.g.
Auth
  RESULT_AUTH_INVALID_ACTION_CODE : int = 6
[static]
Auth
  RESULT_AUTH_INVALID_CREDENTIALS : int = 1
[static] Thrown when one or more of the credentials passed to a method fail to identify and/or authenticate the user subject of that operation.
Auth
  RESULT_AUTH_INVALID_USER : int = 2
[static] Thrown when performing an operation on a FirebaseUser instance that is no longer valid.
Auth
  RESULT_AUTH_MALFORMED_JWT : int = 10
[static] (iOS) Raised when a JWT fails to parse correctly.
Auth
  RESULT_AUTH_RECENT_LOGIN_REQUIERD : int = 3
[static] Deprecated.
Auth
  RESULT_AUTH_RECENT_LOGIN_REQUIRED : int = 3
[static] Thrown on security sensitive operations on a FirebaseUser instance that require the user to have signed in recently, when the requirement isn't met.
Auth
  RESULT_AUTH_USER_COLLISION : int = 4
[static] Thrown when an operation on a FirebaseUser instance couldn't be completed due to a conflict with another existing user.
Auth
  RESULT_AUTH_WEAK_PASSWORD : int = 5
[static] Thrown when using a weak password (less than 6 chars) to create a new account or to update an existing account's password.
Auth
  RESULT_FAILED : int = -2
[static] Thrown when there is an error unrelated to Firebase library directly.
Auth
  RESULT_INVALID_PROVIDER_ID : int = 9
[static] (iOS) Represents the error code for when the given provider id for a web operation is invalid.
Auth
  RESULT_SUCCESS : int = 0
[static] Indicates that the operation has been successfull.
Auth
  RESULT_TOO_MANY_REQUESTS : int = 8
[static] Exception thrown when a request to a Firebase service has been blocked due to having received too many consecutive requests from the same device.
Auth
  VERSION : String = 9.9.0
[static]
Auth
Property Detail
isLogginproperty
isLoggin:Boolean  [read-only]


Implementation
    public static function get isLoggin():Boolean
isPhoneVerificationInProgressproperty 
isPhoneVerificationInProgress:Boolean  [read-only]


Implementation
    public static function get isPhoneVerificationInProgress():Boolean
languageCodeproperty 
languageCode:String

user-facing language code for auth operations that can be internationalized, such as sendEmailVerification(). This language code should follow the conventions defined by the IETF in BCP47.


Implementation
    public static function get languageCode():String
    public static function set languageCode(value:String):void

See also

listenerproperty 
listener:EventDispatcher  [read-only]


Implementation
    public static function get listener():EventDispatcher
Method Detail
applyActionCode()method
public static function applyActionCode($code:String):void

Applies out of band code. This method will not work for out of band codes which require an additional parameter, such as password reset code.

Parameters

$code:String — The out of band code to be applied.

checkActionCode()method 
public static function checkActionCode($code:String):void

Checks the validity of an out of band code. This code will have been generated by sendPasswordResetEmail or sendEmailVerification

Parameters

$code:String — The out of band code to check validity.

confirmPasswordResetWithCode()method 
public static function confirmPasswordResetWithCode($code:String, $newPassword:String):void

Resets the password given a code sent to the user outside of the app and a new password for the user. Code validity can be checked with verifyPasswordResetCode. This use case is only valid for signed-out users, and behavior is undefined for signed-in users. Password changes for signed-in users should be made using FirebaseUser.updatePassword.

Possible error messages:

Parameters

$code:String
 
$newPassword:String — The new password.

createUserWithEmailAndPassword()method 
public static function createUserWithEmailAndPassword($email:String, $password:String):void

Tries to create a new user account with the given email address and password. If successful, it also signs the user in into the app. Upon successful completion, this operation triggers AuthEvents.AUTH_STATE_CHANGED

Important: you must enable Email and Password accounts in the Firebase console before you can use this method.

Possible error messages:

Parameters

$email:String
 
$password:String

fetchProvidersForEmail()method 
public static function fetchProvidersForEmail($emailAddress:String, $callback:Function):void

Deprecated, use fetchSignInMethodsForEmail instead.

Dispatches a list of authentication providers that can be used to sign in a given user (identified by its main email address). This method is useful when you support multiple authentication mechanisms if you want to implement an email-first authentication flow. It is also useful to resolve a Auth.RESULT_AUTH_USER_COLLISION thrown on signIn(_authProvider.getCredential()).

Possible error messages:

Parameters

$emailAddress:String — The email address that identifies the user to fetch the providers from
 
$callback:Function — Expects two params, $methods:Array and $error:Error

fetchSignInMethodsForEmail()method 
public static function fetchSignInMethodsForEmail($emailAddress:String, $callback:Function):void

Returns a list of signin methods that can be used to sign in a given user (identified by its main email address). This method is useful when you support multiple authentication mechanisms if you want to implement an email-first authentication flow. It is also useful to resolve a Auth.RESULT_AUTH_USER_COLLISION thrown on signIn(_authProvider.getCredential()).

Possible error messages:

Parameters

$emailAddress:String — The email address that identifies the user to fetch the providers from
 
$callback:Function — Expects two params, $methods:Array and $error:Error

init()method 
public static function init():void

Call this method prior to any other Auth methods.

isSignInWithEmailLink()method 
public static function isSignInWithEmailLink($link:String):Boolean

Parameters

$link:String

Returns
Boolean
reVerifyPhoneNumber()method 
public static function reVerifyPhoneNumber($phoneNumber:String):void

Android only If your app is closed before the phone auth progress is finished, you should use this method to get back in the progress. Use this property to know: isPhoneVerificationInProgress

If you have already received the verificationId by the AuthEvents.PHONE_CODE_SENT listener, you can simply use the sms code and the verificationId to sign in the user with the signIn method. on iOS, the ANE can't read the sms code automatically. So, when it is received, you should login the user like the following sample.

Parameters

$phoneNumber:String — the phone number for the account the user is signing up for or signing into. Make sure to pass in a phone number with country code prefixed with plus sign ('+').


Example
The following example shows how to signin a user with the verificationId and the sms code
         // create a new authProvider object first
         var authProvider:AuthProvider = new AuthProvider();
                  // decide what kind of credential this authProvider instance will hold
         authProvider.setPhoneAuthProvider("verificationId_received_with_PHONE_CODE_SENT", "SMS_CODE");
                  // finally feed in the Auth.signIn method with the parsed credential info from the authProvider instance.
         Auth.signIn(authProvider.getCredential());
         
sendPasswordResetEmail()method 
public static function sendPasswordResetEmail($emailAddress:String, $actionCodeSettings:ActionCodeSettings = null):void

Triggers the Firebase Authentication backend to send a password-reset email to the given email address, which must correspond to an existing user of your app. Optinally Takes in an ActionCodeSettings which allows linking back to your app from the sent email.

Possible error messages:

Parameters

$emailAddress:String
 
$actionCodeSettings:ActionCodeSettings (default = null)

sendSignInLinkToEmail()method 
public static function sendSignInLinkToEmail($emailAddress:String, $actionCodeSettings:ActionCodeSettings):void

Sends an email to the specified email which will contain a link to be used to sign in the user.

Parameters

$emailAddress:String — The email address of the user.
 
$actionCodeSettings:ActionCodeSettings — An ActionCodeSettings object containing settings related to handling action codes.

signIn()method 
public static function signIn($credential:Object = null):void

Tries to sign in a user with the given credential info. Use this method to sign in a user into your Firebase Authentication system. First retrieve the credential either directly from the user, in case of AuthProvider.EMAIL, or from a supported authentication SDK, such as Google Sign-In or Facebook.

To sign in a user a anonymously, simply pass null when calling this method.

NOTICE: THIS FEATURE IS ONLY AVAILABLE TO MYFLASHLABS CLUB MEMBERS. If you are a club member, you can signin users with other AuthProviders like Facebook, Twitter, Google, Github and Apple rather than simple email/pass authentication through Firebase. This is good enough for most cases. However by Joining the club, you are supporting the MyFlashLabs Team to be able to do their job with more ease.

For all credential types except AuthProvider.EMAIL, this method will create an account for the user in the case that it didn't exist before.

Important: you must configure the authentication providers in the Firebase console before you can use them.

Possible error messages:

Parameters

$credential:Object (default = null) — If you pass null, the user will be signed in anonymously.

signInWithCustomToken()method 
public static function signInWithCustomToken($token:String):void

Asynchronously signs in to Firebase with the given Auth token.

Possible error messages:

Parameters

$token:String — A self-signed custom auth token.

signInWithEmail()method 
public static function signInWithEmail($email:String, $pass:String):void

Deprecated, use signInWithEmailPass instead.

Parameters

$email:String
 
$pass:String

signInWithEmailLink()method 
public static function signInWithEmailLink($email:String, $link:String):void

Tries to sign in a user with the given email address and link. This link should be generated by Auth.sendSignInLinkToEmail(String, ActionCodeSettings).

Important: you must enable Passwordless sign-in in the Firebase console before being able to use this method.

Possible error messages:

Parameters

$email:String
 
$link:String

signInWithEmailPass()method 
public static function signInWithEmailPass($email:String, $pass:String):void

Signs in using an email address and password.

Possible error messages:

Parameters

$email:String — The user’s email address.
 
$pass:String — The user’s password.

signOut()method 
public static function signOut():void

Signs out the current user and clears it from the disk cache. Upon successful completion, this operation triggers AuthEvents.AUTH_STATE_CHANGED

useAppLanguage()method 
public static function useAppLanguage():void

Sets the user-facing language code to be the default app language.

See also

verifyPasswordResetCode()method 
public static function verifyPasswordResetCode($code:String):void

Checks the validity of a verify password reset code.

Parameters

$code:String — The password reset code to be verified.

verifyPhoneNumber()method 
public static function verifyPhoneNumber($phoneNumber:String):void

Starts the phone number verification process for the given phone number. Either sends an SMS with a 6 digit code to the phone number specified or triggers PHONE_VERIFICATION_RESULT that can be used to log in the user.

Parameters

$phoneNumber:String — the phone number for the account the user is signing up for or signing into. Make sure to pass in a phone number with country code prefixed with plus sign ('+').

Constant Detail
ACTION_CODE_OPERATION_PASSWORD_RESETConstant
public static const ACTION_CODE_OPERATION_PASSWORD_RESET:int = 1

Action code for password reset operation

ACTION_CODE_OPERATION_UNKNOWNConstant 
public static const ACTION_CODE_OPERATION_UNKNOWN:int = 0

Action code for unknown operation

ACTION_CODE_OPERATION_VERIFY_EMAILConstant 
public static const ACTION_CODE_OPERATION_VERIFY_EMAIL:int = 2

Action code for verify email operation

EXTENSION_IDConstant 
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.firebase.auth

RESULT_AUTH_EMAIL_EXCEPTIONConstant 
public static const RESULT_AUTH_EMAIL_EXCEPTION:int = 7

Represents the exception which is a result of an attempt to send an email via Firebase Auth (e.g. a password reset email)

RESULT_AUTH_INVALID_ACTION_CODEConstant 
public static const RESULT_AUTH_INVALID_ACTION_CODE:int = 6

RESULT_AUTH_INVALID_CREDENTIALSConstant 
public static const RESULT_AUTH_INVALID_CREDENTIALS:int = 1

Thrown when one or more of the credentials passed to a method fail to identify and/or authenticate the user subject of that operation. Inspect the error code and message to find out the specific cause.

RESULT_AUTH_INVALID_USERConstant 
public static const RESULT_AUTH_INVALID_USER:int = 2

Thrown when performing an operation on a FirebaseUser instance that is no longer valid.

This could happen in the following cases:

You should consider this error condition as if the user had signed out of your app, and thus should require them to sign in again if they need to perform any action that requires authentication.

RESULT_AUTH_MALFORMED_JWTConstant 
public static const RESULT_AUTH_MALFORMED_JWT:int = 10

(iOS) Raised when a JWT fails to parse correctly. May be accompanied by an underlying error describing which step of the JWT parsing process failed.

RESULT_AUTH_RECENT_LOGIN_REQUIERDConstant 
public static const RESULT_AUTH_RECENT_LOGIN_REQUIERD:int = 3

Deprecated. please use RESULT_AUTH_RECENT_LOGIN_REQUIRED instead.

RESULT_AUTH_RECENT_LOGIN_REQUIREDConstant 
public static const RESULT_AUTH_RECENT_LOGIN_REQUIRED:int = 3

Thrown on security sensitive operations on a FirebaseUser instance that require the user to have signed in recently, when the requirement isn't met.

Resolve this exception by asking the user for their credentials again.

RESULT_AUTH_USER_COLLISIONConstant 
public static const RESULT_AUTH_USER_COLLISION:int = 4

Thrown when an operation on a FirebaseUser instance couldn't be completed due to a conflict with another existing user.

This could happen in the following cases:

Resolve this exception by asking the user to sign in again with valid credentials.

RESULT_AUTH_WEAK_PASSWORDConstant 
public static const RESULT_AUTH_WEAK_PASSWORD:int = 5

Thrown when using a weak password (less than 6 chars) to create a new account or to update an existing account's password.

RESULT_FAILEDConstant 
public static const RESULT_FAILED:int = -2

Thrown when there is an error unrelated to Firebase library directly.

RESULT_INVALID_PROVIDER_IDConstant 
public static const RESULT_INVALID_PROVIDER_ID:int = 9

(iOS) Represents the error code for when the given provider id for a web operation is invalid.

RESULT_SUCCESSConstant 
public static const RESULT_SUCCESS:int = 0

Indicates that the operation has been successfull.

RESULT_TOO_MANY_REQUESTSConstant 
public static const RESULT_TOO_MANY_REQUESTS:int = 8

Exception thrown when a request to a Firebase service has been blocked due to having received too many consecutive requests from the same device. Retry the request later to resolve.

VERSIONConstant 
public static const VERSION:String = 9.9.0