Packagecom.distriqt.extension.firebase.auth
Classpublic final class FirebaseAuth
InheritanceFirebaseAuth Inheritance flash.events.EventDispatcher

This class represents the Firebase Auth extension.



Public Properties
 PropertyDefined By
  implementation : String
[read-only] The implementation currently in use.
FirebaseAuth
  isSupported : Boolean
[static] [read-only] Whether the current device supports the extensions functionality
FirebaseAuth
  nativeVersion : String
[read-only] The native version string of the native extension.
FirebaseAuth
  service : FirebaseAuth
[static] [read-only] The singleton instance of the Auth class.
FirebaseAuth
  version : String
[read-only] The version of this extension.
FirebaseAuth
Public Methods
 MethodDefined By
  
Constructor You should not call this directly, but instead use the singleton access
FirebaseAuth
  
createUserWithEmailAndPassword(email:String, password:String):Boolean
Tries to create a new user account with the given email address and password.
FirebaseAuth
  
dispose():void
Disposes the extension and releases any allocated resources.
FirebaseAuth
  
fetchSignInMethodsForEmail(email:String):Boolean
Returns a list of signin methods that can be used to sign in a given user (identified by its main email address).
FirebaseAuth
  
Returns the currently signed-in FirebaseUser or null if there is none You can use getCurrentUser() != null to check if a user is signed in.
FirebaseAuth
  
Returns the language code set in >setLanguageCode().
FirebaseAuth
  
init(key:String):void
Deprecated: You no longer need to call this function or use an application key
[static] Initialises the extension class for use with the provided key.
FirebaseAuth
  
isSignedIn():Boolean
FirebaseAuth
  
isSignInWithEmailLink(link:String):Boolean
Determines if the given link is a link intended for use with signInWithEmailLink().
FirebaseAuth
  
sendPasswordResetEmail(email:String, actionCodeSettings:ActionCodeSettings = null):Boolean
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.
FirebaseAuth
  
sendSignInLinkToEmail(email:String, actionCodeSettings:ActionCodeSettings):Boolean
Sends an email to the specified email which will contain a link to be used to sign in the user.
FirebaseAuth
  
setLanguageCode(languageCode:String):void
Sets the user-facing language code for auth operations that can be internationalized, such as sendEmailVerification().
FirebaseAuth
  
Signs in the user anonymously without requiring any credential.
FirebaseAuth
  
Tries to sign in a user with the given AuthCredential.
FirebaseAuth
  
signInWithCustomToken(customToken:String):Boolean
Tries to sign in a user with a given Custom Token.
FirebaseAuth
  
signInWithEmailAndPassword(email:String, password:String):Boolean
Tries to sign in a user with the given email address and password.
FirebaseAuth
  
signInWithEmailLink(email:String, emailLink:String):Boolean
Tries to sign in a user with the given email address and link.
FirebaseAuth
  
signOut():Boolean
Signs out the current user and clears it from the disk cache.
FirebaseAuth
  
Signs in the user using the mobile browser (either a Custom Chrome Tab or the device's default browser) for the given provider.
FirebaseAuth
  
Sets the user-facing language code to be the default app language.
FirebaseAuth
  
verifyPhoneNumber(phoneNumber:String, timeout:int = 60):Boolean
Starts the phone number verification process for the given phone number.
FirebaseAuth
Events
 Event Summary Defined By
   Dispatched when the authentication state of the current user changes FirebaseAuth
   Dispatched after an attempt to createUserWithEmailAndPassword completes.FirebaseAuth
   Dispatched after an attempt to sendPasswordResetEmail completes.FirebaseAuth
   Dispatched after an attempt to sendSignInLinkToEmail completes.FirebaseAuth
   Dispatched after an attempt to signInAnonymously completes.FirebaseAuth
   Dispatched after an attempt to signInWithCredential completes.FirebaseAuth
   Dispatched after an attempt to signInWithCustomToken completes.FirebaseAuth
   Dispatched after an attempt to signInWithEmailAndPassword completes.FirebaseAuth
   Dispatched after an attempt to signInWithEmailLink completes.FirebaseAuth
   Dispatched when the sign in with provider process is complete startSignInWithProvider.FirebaseAuth
   Dispatched when a code was sent to the specified phone number.FirebaseAuth
   Dispatched when the verify phone number fails.FirebaseAuth
   FirebaseAuth
   FirebaseAuth
Public Constants
 ConstantDefined By
  EXT_CONTEXT_ID : String = com.distriqt.firebase.Auth
[static]
FirebaseAuth
  VERSION : String = 10.1.0
[static]
FirebaseAuth
Property Detail
implementationproperty
implementation:String  [read-only]

The implementation currently in use. This should be one of the following depending on the platform in use and the functionality supported by this extension:


Implementation
    public function get implementation():String
isSupportedproperty 
isSupported:Boolean  [read-only]

Whether the current device supports the extensions functionality


Implementation
    public static function get isSupported():Boolean
nativeVersionproperty 
nativeVersion:String  [read-only]

The native version string of the native extension.


Implementation
    public function get nativeVersion():String
serviceproperty 
service:FirebaseAuth  [read-only]

The singleton instance of the Auth class.


Implementation
    public static function get service():FirebaseAuth

Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
versionproperty 
version:String  [read-only]

The version of this extension.

This should be of the format, MAJOR.MINOR.BUILD


Implementation
    public function get version():String
Constructor Detail
FirebaseAuth()Constructor
public function FirebaseAuth()

Constructor You should not call this directly, but instead use the singleton access

Method Detail
createUserWithEmailAndPassword()method
public function createUserWithEmailAndPassword(email:String, password:String):Boolean

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.

Access the signed-in user with getCurrentUser().

Upon successful completion, this operation triggers an AUTHSTATE_CHANGED event.

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

Parameters

email:String — User email
 
password:String — User password

Returns
Booleantrue if the sign in process was started successfully and false if there was an issue. Most likely your Firebase Application isn't setup correctly. Check the documentation for more.
dispose()method 
public function dispose():void

Disposes the extension and releases any allocated resources. Once this function has been called, a call to init is neccesary again before any of the extensions functionality will work.

fetchSignInMethodsForEmail()method 
public function fetchSignInMethodsForEmail(email:String):Boolean

Returns a list of signin methods that can be used to sign in a given user (identified by its main email address).

Parameters

email:String

Returns
Booleantrue if the process was started successfully and false if there was an issue.
getCurrentUser()method 
public function getCurrentUser():FirebaseUser

Returns the currently signed-in FirebaseUser or null if there is none

You can use getCurrentUser() != null to check if a user is signed in.

Returns
FirebaseUser — the signed-in user or null
getLanguageCode()method 
public function getLanguageCode():String

Returns the language code set in >setLanguageCode().

Returns
String — The language code string

See also

init()method 
public static function init(key:String):void
Deprecated: You no longer need to call this function or use an application key

Initialises the extension class for use with the provided key.

Parameters

key:String


Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
isSignedIn()method 
public function isSignedIn():Boolean

Returns
Boolean
isSignInWithEmailLink()method 
public function isSignInWithEmailLink(link:String):Boolean

Determines if the given link is a link intended for use with signInWithEmailLink(). These links are generated by sendSignInLinkToEmail().

Parameters

link:String — The link to check

Returns
Booleantrue if the link is a "sign in with email" link or false if not.
sendPasswordResetEmail()method 
public function sendPasswordResetEmail(email:String, actionCodeSettings:ActionCodeSettings = null):Boolean

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.

Send a password reset email to a user

You can customize the email template that is used in Authentication section of the Firebase console, on the Email Templates page. See Email Templates in Firebase Help Center.

You can also send password reset emails from the Firebase console.

Parameters

email:String
 
actionCodeSettings:ActionCodeSettings (default = null)

Returns
Booleantrue if the process was started successfully and false if there was an issue.
sendSignInLinkToEmail()method 
public function sendSignInLinkToEmail(email:String, actionCodeSettings:ActionCodeSettings):Boolean

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

Parameters

email:String
 
actionCodeSettings:ActionCodeSettings

Returns
Booleantrue if the process was started successfully and false if there was an issue.
setLanguageCode()method 
public function setLanguageCode(languageCode:String):void

Sets the 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.

Parameters

languageCode:String

signInAnonymously()method 
public function signInAnonymously():Boolean

Signs in the user anonymously without requiring any credential.

They can create a user at a later point by using the linkWithCredential functionality of the anonymous user.

This method creates a new account in your Firebase Authentication system, except in the case where there was already an anonymous user signed in into this app. Access the signed-in user with getCurrentUser().

Upon successful completion, this operation triggers an AUTHSTATE_CHANGED event.

Anonymous users do not require any credential, and are useful in situations where you want to persist information about your users before asking them to sign in. For example, they may be useful when implementing a signed-out shopping cart in an e-commerce application.

Due to the unauthenticated nature of this kind of user, they are not transferrable across devices. In order to allow your app's users to keep their information, ask them to provide some other authentication credentials, and link them to the current user with linkWithCredential(AuthCredential).

Returns
Booleantrue if the sign in process was started successfully and false if there was an issue. Most likely your Firebase Application isn't setup correctly. Check the documentation for more.

See also

com.distriqt.extension.firebase.auth.users.FirebaseUser
signInWithCredential()method 
public function signInWithCredential(credential:AuthCredential):Boolean

Tries to sign in a user with the given AuthCredential.

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 EmailAuthCredential, or from a supported authentication SDK, such as Google Sign-In or Facebook. Later access the signed-in user with getCurrentUser().

For all AuthCredential types except EmailAuthCredential, 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.

Parameters

credential:AuthCredential — AuthCredential

Returns
Booleantrue if the sign in process was started successfully and false if there was an issue. Most likely your Firebase Application isn't setup correctly. Check the documentation for more.
signInWithCustomToken()method 
public function signInWithCustomToken(customToken:String):Boolean

Tries to sign in a user with a given Custom Token.

Use this method after you retrieve a Firebase Auth Custom Token from your server, to sign in a user into your Firebase Authentication system. Access the signed-in user with getCurrentUser().

This operation might create an account if the uid specified in the token corresponds to a user without a record in the system.

Read how to use Custom Token authentication and the cases where it is useful in the guides.

Parameters

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

Returns
Booleantrue if the sign in process was started successfully and false if there was an issue. Most likely your Firebase Application isn't setup correctly. Check the documentation for more.
signInWithEmailAndPassword()method 
public function signInWithEmailAndPassword(email:String, password:String):Boolean

Tries to sign in a user with the given email address and password.

Access the signed-in user with getCurrentUser().

Upon successful completion, this operation triggers an AUTHSTATE_CHANGED event.

This is equivalent to calling signInWithCredential(AuthCredential) with an EmailAuthCredential.

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

Parameters

email:String — User email
 
password:String — User password

Returns
Booleantrue if the sign in process was started successfully and false if there was an issue. Most likely your Firebase Application isn't setup correctly. Check the documentation for more.
signInWithEmailLink()method 
public function signInWithEmailLink(email:String, emailLink:String):Boolean

Tries to sign in a user with the given email address and link. This link should be generated by sendSignInLinkToEmail(). Upon successful completion, this operation triggers an FirebaseAuthEvent.AUTHSTATE_CHANGED event. Important: you must enable Passwordless sign-in in the Firebase console before being able to use this method.

Parameters

email:String — The email address of the user
 
emailLink:String — The email link sent to the users email address

Returns
Booleantrue if the process was started successfully and false if there was an issue.
signOut()method 
public function signOut():Boolean

Signs out the current user and clears it from the disk cache.

Upon successful completion, this operation triggers an AUTHSTATE_CHANGED event.

Returns
Booleantrue if the sign in process was started successfully and false if there was an issue. Most likely your Firebase Application isn't setup correctly. Check the documentation for more.
startSignInWithProvider()method 
public function startSignInWithProvider(provider:OAuthProvider):Boolean

Signs in the user using the mobile browser (either a Custom Chrome Tab or the device's default browser) for the given provider. Note: this call has a UI associated with it, unlike the majority of calls in FirebaseAuth. Dispatches FirebaseAuthEvent.SIGNIN_WITH_PROVIDER_COMPLETE when complete.

Parameters

provider:OAuthProvider — The provider information about how you intend the user to sign in

Returns
Booleantrue if the sign in process was started successfully and false if there was an issue. Most likely your Firebase Application isn't setup correctly.

See also

com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_PROVIDER_COMPLETE
useAppLanguage()method 
public function useAppLanguage():void

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

verifyPhoneNumber()method 
public function verifyPhoneNumber(phoneNumber:String, timeout:int = 60):Boolean

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 the events with a complete AuthCredential 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 ('+').
 
timeout:int (default = 60) — The maximum amount of time in seconds you are willing to wait for SMS auto-retrieval to be completed by the library. Maximum allowed value is 2 minutes. Use 0 to disable SMS-auto-retrieval. If you specifies a positive value less than 30 seconds, library will default to 30 seconds.

Returns
Booleantrue if the verification process was started successfully and false if there was an issue. Most likely your Firebase Application isn't setup correctly. Check the documentation for more.
Event Detail
auth:authstate:changed Event
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.AUTHSTATE_CHANGED

Dispatched when the authentication state of the current user changes
auth:createUserWithEmailAndPassword:complete Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.CREATE_USER_WITH_EMAIL_COMPLETE

Dispatched after an attempt to createUserWithEmailAndPassword completes.
auth:sendPasswordResetEmail:complete Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SEND_PASSWORD_RESET_EMAIL_COMPLETE

Dispatched after an attempt to sendPasswordResetEmail completes.
auth:sendSignInLinkToEmail:complete Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SEND_SIGNIN_LINK_TO_EMAIL_COMPLETE

Dispatched after an attempt to sendSignInLinkToEmail completes.
auth:signInAnonymously:complete Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_ANONYMOUSLY_COMPLETE

Dispatched after an attempt to signInAnonymously completes.
auth:signInWithCredential:complete Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_CREDENTIAL_COMPLETE

Dispatched after an attempt to signInWithCredential completes.
auth:signInWithCustomToken:complete Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_CUSTOMTOKEN_COMPLETE

Dispatched after an attempt to signInWithCustomToken completes.
auth:signInWithEmailAndPassword:complete Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_EMAIL_COMPLETE

Dispatched after an attempt to signInWithEmailAndPassword completes.
auth:signInWithEmailLink:complete Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_EMAILLINK_COMPLETE

Dispatched after an attempt to signInWithEmailLink completes.
auth:signInWithProvider:complete Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_PROVIDER_COMPLETE

Dispatched when the sign in with provider process is complete startSignInWithProvider.
auth:verifyPhoneNumber:codeSent Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.VERIFY_PHONE_NUMBER_CODE_SENT

Dispatched when a code was sent to the specified phone number.

verificationId will contain the id that you can use to create the credential

auth:verifyPhoneNumber:failed Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
FirebaseAuthEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.VERIFY_PHONE_NUMBER_FAILED

Dispatched when the verify phone number fails. Check the message for more information.

user:signin Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseUserEvent
FirebaseUserEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseUserEvent.SIGN_IN

user:signout Event  
Event Object Type: com.distriqt.extension.firebase.auth.events.FirebaseUserEvent
FirebaseUserEvent.type property = com.distriqt.extension.firebase.auth.events.FirebaseUserEvent.SIGN_OUT

Constant Detail
EXT_CONTEXT_IDConstant
public static const EXT_CONTEXT_ID:String = com.distriqt.firebase.Auth

VERSIONConstant 
public static const VERSION:String = 10.1.0