Firebase Auth Plugin

This plugin allows you to log in though firebase auth for iOS(8+) and Android(4.0 +)

Functions:

firebaseAuth.init()

firebaseAuth.createAccount(email, password, listener)
--create account with email

email(string)

password(string)

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.signIn(email, password, listener)
--login with email

email(string)

password(string)

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.sendVerification(listener)
--send a verification email to logined in user

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.resetPassword(email,listener)
--send an email to reset password

email(string) email to sent reset to

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.isSignedIn()
returns boolean, true if logged in, false if not

firebaseAuth.isEmailVerified()
returns boolean, true if email on account logged in is verified, false if not

firebaseAuth.isAnonymous()
returns boolean, true if account is anonymous, false if not

firebaseAuth.getUID()
returns string, unique identifier for account

firebaseAuth.getEmail()
returns string, email for account

firebaseAuth.getDisplayName()
returns string, display name for account

firebaseAuth.getPhoneNumber()
returns string, phone number for account

firebaseAuth.getPhotoUrl()
returns string, url (http://) for account photo

firebaseAuth.getRefreshToken(listener)
--get refresh token for account

listener(function) event.isError(boolean value, true if successful and false if not), event.error(string value, description of error, nil if isError is false), and event.token (string value, refresh token)

firebaseAuth.setPhotoUrl(url,listener)
--set url for account photo

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.setEmail(email,listener)
--set email for account

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.setDisplayName(name,listener)
--set name for account

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.updatePassword(password,listener)
--update password for account

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.deleteAccount(listener)
--delete account

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.signOut(listener)
--sign out of account

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.sendVerificationCode(phoneNumber,listener)
--send verfication code to phone to be used to .signInWithPhoneNumber

phoneNumber(string) phone number to send code to

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.signInWithPhoneNumber(code,listener)
--send verfication code to phone to be used to .signInWithPhoneNumber

code(string) code sent with .sendVerificationCode

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.signInWithGoogle(idToken, accessToken,listener)
--sign in with google

idToken(string) id token for google

accessToken(string) access token for google

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.signInWithFacebook(accessToken, listener)
--sign in with facebook(Please note you have to handle sign in yourself)

accessToken(string) access token for facebook

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.signInWithTwitter(token, secret, listener)
--sign in with twitter(Please note you have to handle sign in yourself)

token(string)

secret(string)

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.signInWithGithub(accessToken, listener)
--sign in with github(Please note you have to handle sign in yourself)

accessToken(string)

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.signInWithCustomToken(accessToken, listener)
--sign in with customer server

accessToken(string)

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.signInAnonymously(listener)
--sign in without account and used for security

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false)

firebaseAuth.isNetworkAvailable()
--check for wifi access, returns boolean, true if device has internet access, false if not

firebaseAuth.doesEmailExist(listener, email)
--checks if email is already registered

listener(function) event.isError(boolean value, true if successful and false if not) and event.error(string value, description of error, nil if isError is false). If isError is false then event.doesEmailExist (boolean is returned, true if email exists, false if email does not exists).

email(string) email to check if registered

firebaseAuth.setAPNSToken(APNSToken, mode)
--set the apns token

APNSToken(string) Apple push notifications

mode(string) "prod"(production), "sandbox"(sandbox), and "unknown"

Setup:

Make sure you download and include GoogleServices-Info.plist and put in root folder of corona project. Also add your google-services.json to your root folder and useGoogleServicesJson = true in build.settings. Please note according to firebase docs, you must have firebase cloud messaging enabled for phone login. Please follow setup on Corona FCM plugin page

Helpful Links:

Example

Support

Get Plugin