/FireAuth

An Open Source JavaScript wrapper for Firebase's native and third-party authentications.

Primary LanguageJavaScript

FireAuth

An Open Source JavaScript wrapper for Firebase's native and third-party authentications.

Usage

#####HTML

<script src="https://filehost.firebaseapp.com/FireAuth/FireAuth-0.0.1.js"></script>

or

<script src="path/to/FireAuth-0.0.1.js"></script>

#####JS var accountInstance = new AccountJS("https://MYFIREBASEREF.firebaseio.com/");

Creating a User

accountInstance.createUserWithEmail("email@email.com", "password", function(userData){
  //Handle user creation  
})
In order to use FireAuth, you must enable User Authentication in your Firebase Authentication Settings
For Facebook authentication, you must configure your application for Facebook.

Functions

createUserWithEmail(email, password, callback)

Creates a new Firebase user with Email and Password Authentication.

loginWithEmail(email, password, token, callback)

Logs in a Firebase user with Email and Password Authentication.

changeUserPassword(email, oldPassword, newPassword, callback)

Changes a Firebase user's password.

changeUserEmail(oldEmail, newEmail, password, callback)

Changes a Firebase user's email.

resetUserPassword(email, callback)

Sends a reset password email to the user.

deleteUserWithEmail(email, password, callback)

Deletes a Firebase user with Email and Password Authentication.

loginWithFacebook(redirect, callback)

Logs in a Firebase user with Facebook Authentication. Make sure your application is configured as a Facebook App.

logout()

Logs out a user and removes authentication token.

## createUserWithEmail(email, password, callback) Creates a new Firebase user with Email and Password Authentication.

Kind: global function

Param Type Description
email string The user's email
password string The user's password
callback function Optional callback function with parameter userData. (Called upon successful account creation)

loginWithEmail(email, password, token, callback)

Logs in a Firebase user with Email and Password Authentication.

Kind: global function

Param Type Description
email string The user's email
password string The user's password
token boolean True to create an auth token, false to not create one.
callback function Optional callback function with parameter authData. (Called upon successful login)

changeUserPassword(email, oldPassword, newPassword, callback)

Changes a Firebase user's password.

Kind: global function

Param Type Description
email string The user's email
oldPassword string The user's original password
newPassword string The user's new password
callback function Optional callback function. (Called upon successful password change)

changeUserEmail(oldEmail, newEmail, password, callback)

Changes a Firebase user's email. (Must configure in Firebase Settings)

Kind: global function

Param Type Description
oldEmail string The user's original email
newEmail string The user's new email
password string The user's password
callback function Optional callback function. (Called upon successful email change)

resetUserPassword(email, callback)

Sends a reset password email to the user.

Kind: global function

Param Type Description
email string The user's email
callback function Optional callback function. (Called once reset email is sent)

deleteUserWithEmail(email, password, callback)

Deletes a Firebase user with Email and Password Authentication.

Kind: global function

Param Type Description
email string The user's email
password string The user's password
callback function Optional callback function. (Called upon successful account deletion)

loginWithFacebook(redirect, callback)

Logs in a Firebase user with Facebook Authentication. Make sure your application is configured as a Facebook App.

Kind: global function

Param Type Description
redirect boolean Whether the webpage should redirect the current page. If false the webpage will just open a popup to Facebook.
callback function Optional callback function with parameter authData that will not get called if redirect is true. (Called upon successful login)

logout()

Logs out a user and removes authentication token.

Kind: global function

Created by Ayush Jain and Rohan Iyer