Skip to content

Commit 493c94e

Browse files
committed
adding two missing snippets
1 parent 86618be commit 493c94e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

auth/custom_claims.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,12 @@ admin.auth().verifyIdToken(idToken).then((claims) => {
2121
// Allow access to requested admin resource.
2222
}
2323
});
24-
// [END verify_custom_claims]
24+
// [END verify_custom_claims]
25+
26+
// [START read_custom_user_claims]
27+
// Lookup the user associated with the specified uid.
28+
admin.auth().getUser(uid).then((userRecord) => {
29+
// The claims can be accessed on the user record.
30+
console.log(userRecord.customClaims.admin);
31+
});
32+
// [END read_custom_user_claims]

auth/email_action_links.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ const actionCodeSettings = {
2222
};
2323
// [END init_action_code_settings]
2424

25+
// [START password_reset_link]
26+
// Admin SDK API to generate the password reset link.
27+
const userEmail = '[email protected]';
28+
admin.auth().generatePasswordResetLink(userEmail, actionCodeSettings)
29+
.then((link) => {
30+
// Construct password reset email template, embed the link and send
31+
// using custom SMTP server.
32+
return sendCustomPasswordResetEmail(email, displayName, link);
33+
})
34+
.catch((error) => {
35+
// Some error occurred.
36+
});
37+
// [END password_reset_link]
38+
2539
// [START email_verification_link]
2640
// Admin SDK API to generate the password reset link.
2741
const email = '[email protected]';

0 commit comments

Comments
 (0)