-
Notifications
You must be signed in to change notification settings - Fork 990
Initialize App Check debug mode in initializeAppCheck #5512
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
|
Changeset File Check ✅
|
packages/app-check/src/api.ts
Outdated
| initializeDebugMode(); | ||
| } | ||
|
|
||
| // Log a warning when `initializeAppCheck()` is called in debug mode, |
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.
Comment needs update.
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.
Updated.
packages/app-check/src/api.test.ts
Outdated
| expect(consoleStub.args[0][0]).to.include(token); | ||
| self.FIREBASE_APPCHECK_DEBUG_TOKEN = undefined; | ||
| }); | ||
| it('warns about debug mode on second call', async () => { |
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.
What does it test?
I think we need a test to verify initializeDebugMode is called only once.
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.
Oh wow, the test caught the fact that I was not setting the initialize property... thanks.
|
Please add a changeset. @hsubox76 |
Initialize debug mode for App Check (i.e., reading the global var) in the first call to
initializeAppCheck()instead of when the app-check component is registered. This makes it easier for developers to set the variable in code.Additionally, it logs a
console.warnon subsequent calls to initializeAppCheck notifying the user they are still in debug mode, and logging the token (if they don't reload/quit before that token promise resolves). This may help HMR users who lose the initial token message.