Email & Password Authentication - Firebase
Email & Password Authentication - Firebase
Email&PasswordAuthenticationFirebase
Web Guide
User Authentication
1/7
15/3/2016
Email&PasswordAuthenticationFirebase
Logging Users In
Once an account has been created, you can log a user in with the following snippet:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Optional Settings
authWithPassword()
Description
Type
String
Here is an example of password login where the session will expire upon
browser shutdown:
https://www.firebase.com/docs/web/guide/login/password.html
2/7
15/3/2016
Email&PasswordAuthenticationFirebase
1.
2.
3.
4.
5.
6.
7.
The
authData
Field
uid
provider
token
Description
A unique user ID, intended as the user's unique
key across all providers.
Type
String
String
String
Object
expires
Number
password
Object
password.email
String
https://www.firebase.com/docs/web/guide/login/password.html
3/7
15/3/2016
Email&PasswordAuthenticationFirebase
password.isTemporaryPassword
Boolean
password.profileImageURL
String
auth
Field
Description
Type
uid
A unique user ID, intended as the user's unique key across all providers.
String
provider
String
auth
Rules:
1.
2.
3.
4.
5.
6.
7.
"rules": {
"users": {
"$uid": {
// grants write access to the owner of this user account whose uid must exact
".write": "auth !== null && auth.uid === $uid",
https://www.firebase.com/docs/web/guide/login/password.html
4/7
15/3/2016
8.
9.
10.
11.
12.
13.
Email&PasswordAuthenticationFirebase
// grants read access to any user who is logged in with an email and password
".read": "auth !== null && auth.provider === 'password'"
}
}
}
}
See the User Authentication and User Based Security articles for more details.
Changing Emails
You can change the email for a user using the existing email address and password as
shown:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
Changing Passwords
You can change the password for a user using the email address and current password
as shown:
1.
2.
3.
4.
5.
https://www.firebase.com/docs/web/guide/login/password.html
5/7
15/3/2016
6.
7.
8.
9.
10.
11.
12.
Email&PasswordAuthenticationFirebase
}, function(error) {
if (error === null) {
console.log("Password changed successfully");
} else {
console.log("Error changing password:", error);
}
});
You can edit the content of the password reset email from the Login & Auth tab of your
App Dashboard.
Deleting Users
You can delete a user using their email address and password as shown below:
1.
2.
3.
4.
5.
6.
7.
8.
9.
https://www.firebase.com/docs/web/guide/login/password.html
6/7
15/3/2016
10.
11.
Email&PasswordAuthenticationFirebase
}
});
https://www.firebase.com/docs/web/guide/login/password.html
7/7