Last active
January 15, 2020 23:47
-
-
Save tianhaoz95/c2a55f383062e40ff656b8084c0abfbe to your computer and use it in GitHub Desktop.
Token to context Firebase implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async token2context(token: string): Promise<FunctionContext> { | |
const context: FunctionContext = { authenticated: false, uid: "na" }; | |
try { | |
const verifyResult = await this.auth.verifyIdToken(token); | |
context.authenticated = true; | |
context.uid = verifyResult.uid; | |
} catch (err) { | |
console.log(err); | |
} | |
return context; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment