Uh oh!
There was an error while loading. Please reload this page.
Improve token verification logic with Auth Emulator. - #1148
Conversation
hiranya911
left a comment
There was a problem hiding this comment.
Thanks @yuchenshi. The implementation looks pretty good. However, we need more work to round off testing. My suggestion is to update the CI setup to invoke the auth integ tests against the emulator as part of our regular builds.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } else if (payload.iss !== this.issuer + projectId) { | ||
| errorMessage = `${this.tokenInfo.jwtName} has incorrect "iss" (issuer) claim. Expected ` + | ||
| `"${this.issuer}"` + projectId + '" but got "' + | ||
| `"${this.issuer}` + projectId + '" but got "' + |
There was a problem hiding this comment.
nit: took me a while staring at this diff because of the mixed use of string templates and string concatenation via +. No need to do anything though, probably not in scope.
hiranya911
left a comment
There was a problem hiding this comment.
LGTM with a suggestion. Also give @bojeil-google a chance to review before merging.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Discussion
This PR implements http://go/firebase-auth-emulator-admin-sdk (Google internal design doc). Token verification now works everywhere, not just in functions emulator.
Testing
Ran
node ~/w/firebase-tools/lib/bin/firebase.js emulators:exec --project fake-project-id --only auth 'npx mocha test/integration/auth.spec.ts --slow 5000 --timeout 20000 --require ts-node/register'manually and all tests passed locally (once unrelated pending fixes in the Auth Emulator such as firebase/firebase-tools#3091 and firebase/firebase-tools#3088 are applied).API Changes
(secret API removed; no public API changes)