Package | com.distriqt.extension.firebase.auth |
Class | public final class FirebaseAuth |
Inheritance | FirebaseAuth ![]() |
This class represents the Firebase Auth extension.
Property | Defined 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 |
Method | Defined 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 | ||
getLanguageCode():String
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 | ||
signInAnonymously():Boolean
Signs in the user anonymously without requiring any credential. | FirebaseAuth | ||
signInWithCredential(credential:AuthCredential):Boolean
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 | ||
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. | FirebaseAuth | ||
useAppLanguage():void
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 |
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 |
Constant | Defined By | ||
---|---|---|---|
EXT_CONTEXT_ID : String = com.distriqt.firebase.Auth [static] | FirebaseAuth | ||
VERSION : String = 10.1.0 [static] | FirebaseAuth |
implementation | property |
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:
Android
iOS
default
unknown
public function get implementation():String
isSupported | property |
isSupported:Boolean
[read-only] Whether the current device supports the extensions functionality
public static function get isSupported():Boolean
nativeVersion | property |
nativeVersion:String
[read-only]
The native version string of the native extension.
public function get nativeVersion():String
service | property |
service:FirebaseAuth
[read-only] The singleton instance of the Auth class.
public static function get service():FirebaseAuth
Error — If there was a problem creating or accessing the extension, or if the key is invalid
|
version | property |
version:String
[read-only]
The version of this extension.
This should be of the format, MAJOR.MINOR.BUILD
public function get version():String
FirebaseAuth | () | Constructor |
public function FirebaseAuth()
Constructor You should not call this directly, but instead use the singleton access
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
|
Boolean — true 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 |
Boolean — true 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.
FirebaseUser — the signed-in user or null
|
getLanguageCode | () | method |
public function getLanguageCode():String
Returns the language code set in >setLanguageCode()
.
String — The language code string
|
See also
init | () | method |
public static function init(key:String):void
Initialises the extension class for use with the provided key.
Parameters
key:String |
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
|
Boolean — true 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 )
|
Boolean — true 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 |
Boolean — true 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)
.
Boolean — true 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
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
|
Boolean — true 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.
|
Boolean — true 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
|
Boolean — true 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
|
Boolean — true 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.
Boolean — true 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
|
Boolean — true 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
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.
|
Boolean — true 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.
|
auth:authstate:changed | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.AUTHSTATE_CHANGED
Dispatched when the authentication state of the current user changes
auth:createUserWithEmailAndPassword:complete | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.CREATE_USER_WITH_EMAIL_COMPLETE
Dispatched after an attempt to
createUserWithEmailAndPassword
completes.
auth:sendPasswordResetEmail:complete | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SEND_PASSWORD_RESET_EMAIL_COMPLETE
Dispatched after an attempt to
sendPasswordResetEmail
completes.
auth:sendSignInLinkToEmail:complete | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SEND_SIGNIN_LINK_TO_EMAIL_COMPLETE
Dispatched after an attempt to
sendSignInLinkToEmail
completes.
auth:signInAnonymously:complete | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_ANONYMOUSLY_COMPLETE
Dispatched after an attempt to
signInAnonymously
completes.
auth:signInWithCredential:complete | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_CREDENTIAL_COMPLETE
Dispatched after an attempt to
signInWithCredential
completes.
auth:signInWithCustomToken:complete | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_CUSTOMTOKEN_COMPLETE
Dispatched after an attempt to
signInWithCustomToken
completes.
auth:signInWithEmailAndPassword:complete | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_EMAIL_COMPLETE
Dispatched after an attempt to
signInWithEmailAndPassword
completes.
auth:signInWithEmailLink:complete | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent.SIGNIN_WITH_EMAILLINK_COMPLETE
Dispatched after an attempt to
signInWithEmailLink
completes.
auth:signInWithProvider:complete | Event |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
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 |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
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 |
com.distriqt.extension.firebase.auth.events.FirebaseAuthEvent
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 |
com.distriqt.extension.firebase.auth.events.FirebaseUserEvent
com.distriqt.extension.firebase.auth.events.FirebaseUserEvent.SIGN_IN
user:signout | Event |
com.distriqt.extension.firebase.auth.events.FirebaseUserEvent
com.distriqt.extension.firebase.auth.events.FirebaseUserEvent.SIGN_OUT
EXT_CONTEXT_ID | Constant |
public static const EXT_CONTEXT_ID:String = com.distriqt.firebase.Auth
VERSION | Constant |
public static const VERSION:String = 10.1.0