rex_firebase_authentication
Introduction
Authentication which provided by firebase.
This plugin supports built-in functionality for email & password auth and third-party providers such as Facebook, Twitter, GitHub, and Google. See this page first to understand how to enable these features.
Authentication which provided by firebase.
This plugin supports built-in functionality for email & password auth and third-party providers such as Facebook, Twitter, GitHub, and Google. See this page first to understand how to enable these features.
Usage
Authentication by third-party providers
Sample capx
Sample capx
Enable provider
Enable provider by these steps first.
Enable provider by these steps first.
- Go to the Account Dashboard.
- Select your Firebase.
- Choose the Login & Auth tab.
- Find the Authentication Providers section.
- Select a tab for a provider and enable authentication.
- If you're using a social login provider, like Facebook, copy your client ID and secret into the form.
Login
Call "Action:Login" under "Authentication provider" category to login by third-party provider.
"Condition:On login successfully" will be triggered if login successful. Get login information by these expressions -
Call "Action:Login" under "Authentication provider" category to login by third-party provider.
"Condition:On login successfully" will be triggered if login successful. Get login information by these expressions -
Expression:UserID - A unique user ID, intended as the user's unique key across all providers
Expression:Provider
Expression:DisplayName
Expression:UserIDFromProvider
Expression:AccessToken
Expression:Email
Expression:UserName
Expression:CachedUserProfile
Expression:PhotoURL ( 3.x only )
"Expression:UserID" is the most important expression which combined from "Expression:Provider" and "Expression:UserIDFromProvider".
"Expression:CachedUserProfile" is a JSON string, it could be parsed by JSON plugin. Explore this data structure in debug panel.
"Expression:CachedUserProfile" is a JSON string, it could be parsed by JSON plugin. Explore this data structure in debug panel.
Login failed
"Condition:On login error" will be triggered if logging failed. Get error message by "Expression:ErrorMessage" or error code by "Expression:ErrorCode". See here to get full error listing.
"Condition:On login error" will be triggered if logging failed. Get error message by "Expression:ErrorMessage" or error code by "Expression:ErrorCode". See here to get full error listing.
Logging out
Call "Action:Logging out" to logging out current account, and "Condition:On logged out" will be triggered.
Designer might add this action before login to clean remembered login.
Call "Action:Logging out" to logging out current account, and "Condition:On logged out" will be triggered.
Designer might add this action before login to clean remembered login.
Login with access token for facebook
Designer could use another plugin like official facebook plugin to login. Then call "Action:Connect Facebook" to login to firebase.
Leave parameter "Access token" to "" for official facebook plugin, or assign access token if available.
Designer could use another plugin like official facebook plugin to login. Then call "Action:Connect Facebook" to login to firebase.
Leave parameter "Access token" to "" for official facebook plugin, or assign access token if available.
Is login
"Condition:Is login" will return true if logging in now.
"Condition:Is login" will return true if logging in now.
Authentication by built-in email & password
Sample capx
Sample capx
Create account
Call "Action:Create account" to create account.
"Condition:On creating account successfully" will be triggered if creating successful, otherwise "Condition:On creating account error" for creating error. Get error message by "Expression:ErrorMessage" or error code by "Expression:ErrorCode". See here to get full error listing.
Call "Action:Create account" to create account.
"Condition:On creating account successfully" will be triggered if creating successful, otherwise "Condition:On creating account error" for creating error. Get error message by "Expression:ErrorMessage" or error code by "Expression:ErrorCode". See here to get full error listing.
Login
Call "Action:Login" under "Email & Password" category to login by built-in email & password. Login information and triggers are the same with third-party provider at previous section.
Call "Action:Login" under "Email & Password" category to login by built-in email & password. Login information and triggers are the same with third-party provider at previous section.
Change password
Call "Action:Change password" could change password of current account, or call "Action:Sending password reset email" to reset password.
"Condition:On changing password successfully" will be triggered if successful, otherwise "Condition:On changing password error" will be triggered.
Call "Action:Change password" could change password of current account, or call "Action:Sending password reset email" to reset password.
"Condition:On changing password successfully" will be triggered if successful, otherwise "Condition:On changing password error" will be triggered.
Update profile
Call "Action:Update profile" to update display name and photo URL. "Condition:On updating profile success" will be triggered while updating success, otherwise "Condition:On updating profile error" will be triggered.
Call "Action:Update profile" to update display name and photo URL. "Condition:On updating profile success" will be triggered while updating success, otherwise "Condition:On updating profile error" will be triggered.
Delete user
Call "Action:Delete user" to delete user.
"Condition:On deleting user successfully" will be triggered if successful, otherwise "Condition:On deleting user error" will be triggered.
Call "Action:Delete user" to delete user.
"Condition:On deleting user successfully" will be triggered if successful, otherwise "Condition:On deleting user error" will be triggered.
Authentication by Anonymous
Login
Call "Action:Login" under "Anonymous" category to login by Anonymous. Login information and triggers are the same with third-party provider at previous section.
"Condition:Is anonymous" will return true if current user is logged by anonymous.
Call "Action:Login" under "Anonymous" category to login by Anonymous. Login information and triggers are the same with third-party provider at previous section.
"Condition:Is anonymous" will return true if current user is logged by anonymous.
Authentication by authentication token
Login
Call "Action:Login" under "Authentication token" category to login by Authentication token. Login information and triggers are the same with third-party provider at previous section.
Call "Action:Login" under "Authentication token" category to login by Authentication token. Login information and triggers are the same with third-party provider at previous section.
Login or logged out by other app
Once a user authenticates to your app, Firebase manages their session, ensuring that the user is remembered across browser or application restarts. (reference)
"Condition:On login by other app" or "Condition:On logged out by other app" will be triggered while login status had changed by other app.
Once a user authenticates to your app, Firebase manages their session, ensuring that the user is remembered across browser or application restarts. (reference)
"Condition:On login by other app" or "Condition:On logged out by other app" will be triggered while login status had changed by other app.
Link multiple auth providers to an account
Current user could link to another authentication providers by these actions
Current user could link to another authentication providers by these actions
- "Action:Link to facebook" , link to a facebook account by access token ( sample capx )
- "Action:Link to google" , link to a google account by id token
- "Action:Link to email-password" , link to an email-password account ( sample capx )
Debug panel
UserID, display name, email, photo URL of current user will be shown at debug panel.
UserID, display name, email, photo URL of current user will be shown at debug panel.
Run at mobile app
If anyone use the Firebase Authentication Plugin to build Cordova project, you have to add "In App Browser Plugin" to make it work. You may find "In App Browser Plugin" from Cranberrygames's work.
If anyone use the Firebase Authentication Plugin to build Cordova project, you have to add "In App Browser Plugin" to make it work. You may find "In App Browser Plugin" from Cranberrygames's work.