-
Notifications
You must be signed in to change notification settings - Fork 900
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
Initialize App Check debug mode in initializeAppCheck #5512
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2952e2f
Initialize debug mode on initializeAppCheck
hsubox76 86331a5
prettier
hsubox76 c5a90de
Address PR comments
hsubox76 76186e8
prettier
hsubox76 0c329f7
Address PR comments
hsubox76 675fb02
Fix debug initialize flag
hsubox76 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,6 @@ import { | |
} from './internal-api'; | ||
import { readTokenFromStorage } from './storage'; | ||
import { getDebugToken, initializeDebugMode, isDebugMode } from './debug'; | ||
import { logger } from './logger'; | ||
|
||
declare module '@firebase/component' { | ||
interface NameServiceMapping { | ||
|
@@ -67,14 +66,13 @@ export function initializeAppCheck( | |
// Log a warning when `initializeAppCheck()` is called in debug mode, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
// and show the token. | ||
if (isDebugMode()) { | ||
logger.warn( | ||
`App Check is in debug mode. To turn off debug mode, unset ` + | ||
`the global variable FIREBASE_APPCHECK_DEBUG_TOKEN and ` + | ||
`restart the app.` | ||
// Do not block initialization to get the token for the message. | ||
void getDebugToken().then(token => | ||
// Not using logger because I don't think we ever want this accidentally hidden. | ||
console.log( | ||
`App Check debug token: ${token}. You will need to add it to your app's App Check settings in the Firebase console for it to work.` | ||
) | ||
); | ||
// Make this a separate console statement so user will at least have the | ||
// first message if the token promise doesn't resolve in time. | ||
void getDebugToken().then(token => logger.warn(`Debug token is ${token}.`)); | ||
} | ||
|
||
if (provider.isInitialized()) { | ||
|
This file contains 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.