Skip to content

Instantly share code, notes, and snippets.

@ancyrweb
Last active December 22, 2022 21:37
Show Gist options
  • Save ancyrweb/18ca1719847b05a6e6f5e53b31f3d60b to your computer and use it in GitHub Desktop.
Save ancyrweb/18ca1719847b05a6e6f5e53b31f3d60b to your computer and use it in GitHub Desktop.
async generateIDToken(uid: string) {
const customToken = await this.admin.auth().createCustomToken(uid);
const res = await rp({
url: `https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyCustomToken?key=${this.apikey}`,
method: 'POST',
body: {
token: customToken,
returnSecureToken: true,
},
json: true,
});
return {
token: res.idToken,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment