Skip to content

Commit 4fadb87

Browse files
authored
Added updateProfile and updateEmail for modular SDK (firebase#178)
1 parent 54afdf5 commit 4fadb87

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules
44
tsconfig.json
55
dist/
66
.DS_Store
7+
.idea

auth-next/manage.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
function updateUserProfile() {
2+
// [START auth_update_user_profile]
3+
const { getAuth, updateProfile } = require("firebase/auth");
4+
const auth = getAuth();
5+
updateProfile(auth.currentUser, {
6+
displayName: "Jane Q. User", photoURL: "https://example.com/jane-q-user/profile.jpg"
7+
}).then(() => {
8+
// Profile updated!
9+
}).catch((error) => {
10+
const errorCode = error.code;
11+
const errorMessage = error.message;
12+
// ..
13+
});
14+
// [END auth_update_user_profile]
15+
}
16+
17+
function updateUserEmail() {
18+
// [START auth_update_user_email]
19+
const { getAuth, updateEmail } = require("firebase/auth");
20+
const auth = getAuth();
21+
updateEmail(auth.currentUser, "user@example.com").then(() => {
22+
// Email updated!
23+
}).catch((error) => {
24+
const errorCode = error.code;
25+
const errorMessage = error.message;
26+
// ..
27+
});
28+
// [END auth_update_user_email]
29+
}

0 commit comments

Comments
 (0)