npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fireauth

v1.0.4

Published

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

Downloads

16

Readme

FireAuth

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

Setup

#####HTML

<script src="https://rawgit.com/FireAuth/FireAuth/master/FireAuth-0.0.1.js"></script>

or

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

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

In order to use FireAuth, you must enable User Authentication in your Firebase Authentication Settings

Third Part Authentication Configuration Guides

Facebook
GitHub
Google
Twitter

Classes

Kind: global class
Attribute: string tokenName - name of the token that will be stored in user's browser (This should not be kept default and should remain constant)

new FireAuth(firebaseURL)

| Param | Type | Description | | --- | --- | --- | | firebaseURL | string | The URL of the Firebase reference. |

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) |

Example

fireAuthInstance.createUserWithEmail("[email protected]", "correcthorsebatterystaple", function(userData){
     // The user creation was successful
     doStuffWith(userData);
})

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) |

Example

fireAuthInstance.loginWithEmail("[email protected]", "correcthorsebatterystaple", false, function(authData){
     // The authentication was successful.
     doStuffWith(authData);
})

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) |

Example

fireAuthInstance.changeUserPassword("[email protected]", "correcthorsebatterystaple", "youwillneverguessthis", function(){
     // Password has been changed - handle anything else here.
})

changeUserEmail(oldEmail, newEmail, password, callback)

Changes a Firebase user's email.

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) |

Example

fireAuthInstance.changeUserEmail("[email protected]", "[email protected]", "correcthorsebatterystaple", function(){
     // Email has been changed - handle anything else here.
})

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) |

Example

fireAuthInstance.resetUserPassword("[email protected]", function(){
     // Email has been sent - handle anything else here.
})

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) |

Example

fireAuthInstance.deleteUserWithEmail("[email protected]", "correcthorsebatterystaple", function(){
     // Successfully deleted user within Firebase - Handle anything else here.
})

loginWithFacebook(redirect, token, sessionTime, permissions, 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. | | token | boolean | True to create an auth token, false to not create one. | | sessionTime | string | If not specified - or set to default - sessions are persisted for as long as you have configured in the Login & Auth tab of your App Dashboard. To limit persistence to the lifetime of the current window, set this to sessionOnly. A value of none will not persist authentication data at all and will end authentication as soon as the page is closed. | | permissions | string | A set of permissions your application may want to access from the user's Facebook account. Certain permissions will have to be approved by the user and Facebook. Each of these permissions can be accessed through the callback. Click here to view some of the permissions that can be access from Facebook. | | callback | function | Optional callback function with parameter authData that will not get called if redirect is true. (Called upon successful login) [NOTE: Alternatively, this can be done with the "authChangeListener" function] |

Example

fireAuthInstance.loginWithFacebook(false, true, "default", "email, user_likes" , function(authData){
     // The authentication was successful and opened within a popup.
     doStuffWith(authData);
});

loginWithGithub(redirect, token, sessionTime, permissions, callback)

Logs in a Firebase user with GitHub Authentication. Make sure your application is configured as a GitHub 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 GitHub. | | token | boolean | True to create an auth token, false to not create one. | | sessionTime | string | If not specified - or set to default - sessions are persisted for as long as you have configured in the Login & Auth tab of your App Dashboard. To limit persistence to the lifetime of the current window, set this to sessionOnly. A value of none will not persist authentication data at all and will end authentication as soon as the page is closed. | | permissions | string | A set of permissions your application may want to access from the user's Github account. Certain permissions will have to be approved by the user and Github. Each of these permissions can be accessed through the callback. Click here to view some of the permissions that can be access from Github. | | callback | function | Optional callback function with parameter authData that will not get called if redirect is true. (Called upon successful login) [NOTE: Alternatively, this can be done with the "authChangeListener" function] |

Example

fireAuthInstance.loginWithGithub(false, false, "default", "user, notifications, read:org" , function(authData){
     // The authentication was successful and opened within a popup.
     doStuffWith(authData);
});

loginWithGoogle(redirect, token, sessionTime, permissions, callback)

Logs in a Firebase user with Google Authentication. Make sure your application is configured as a Google 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 Google. | | token | boolean | True to create an auth token, false to not create one. | | sessionTime | string | If not specified - or set to default - sessions are persisted for as long as you have configured in the Login & Auth tab of your App Dashboard. To limit persistence to the lifetime of the current window, set this to sessionOnly. A value of none will not persist authentication data at all and will end authentication as soon as the page is closed. | | permissions | string | A set of permissions your application may want to access from the user's Google account. Certain permissions will have to be approved by the user and Google. Each of these permissions can be accessed through the callback. Click here to view some of the permissions that can be access from Google. | | callback | function | Optional callback function with parameter authData that will not get called if redirect is true. (Called upon successful login) [NOTE: Alternatively, this can be done with the "authChangeListener" function] |

Example

fireAuthInstance.loginWithGoogle(true, false "none", "profile, openid" , function(authData){
     // The authentication was successful and opened within a popup.
     doStuffWith(authData);
});

loginWithTwitter(options, callback)

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

Kind: global function

| Param | Type | Description | | --- | --- | --- | | options | object | Object with optional values. | | options.redirect | boolean | Whether the webpage should redirect the current page. If false or not defined the webpage will just open a popup to Twitter. | | options.token | boolean | True to create an auth token, false or undefined to not create one. | | options.sessionTime | string | If not specified - or set to default - sessions are persisted for as long as you have configured in the Login & Auth tab of your App Dashboard. To limit persistence to the lifetime of the current window, set this to sessionOnly. A value of none will not persist authentication data at all and will end authentication as soon as the page is closed. | | callback | function | Optional callback function with parameters error and authData that will not get called if redirect is true. (Called upon successful or unsuccessful login)[NOTE: Alternatively, this can be done with the "authChangeListener" function] |

Example

fireAuthInstance.loginWithTwitter(false, true, "sessionOnly", function(authData){
     // The authentication was successful and opened within a popup.
     doStuffWith(authData);
});

logout()

Logs out a user and removes authentication token.

Kind: global function

authChangeListener(onLogin, onLogout)

Event handler checks any changes in user authentication. Can also be used as an alternative to callbacks from other login functions.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | onLogin | function | A function with parameter authData that will get called if the user becomes authenticated or is already logged in. | | onLogout | function | A function with parameter authData that will get called if the user becomes unauthenticated or is already logged out. |

Example

fireAuthInstance.authChangeListener(function(authData){
     //The user has logged in
     doStuffWith(authData);
}, function(authData){
     //The user has logged out
     doStuffWith(authData);
})

setTokenName(newTokenName)

Sets the token id or name.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | newTokenName | string | the new name of your token. |

Example

setTokenName("myTokenForMyFirstWebApp");
Created by Ayush Jain and Rohan Iyer