-
Notifications
You must be signed in to change notification settings - Fork 210
Support consumeAppCheckToken option for callable functions #1374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/common/providers/https.ts
Outdated
appCheckData = await getAppCheck(getApp()).verifyToken(appCheck); | ||
const appCheck = getAppCheck(getApp()); | ||
if (options.consumeAppCheckToken) { | ||
if (appCheck.verifyToken.length === 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be wrong here but if appCheck.verifyToken
is undefined
, accessing .length
throws, doesn't it?
Would it be better to do the following instead?
if (typeof appCheck.verifyToken === "function") {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that you are checking the number of parameters here. If we are confident that the Admin SDK used always has the appCheck API, please ignore my comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think defensive coding is better here!
No description provided.