Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/afraid-moose-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/app-check': minor
---

Fix issue where forceRefresh errors in App Check token retrieval were silently handled, ensuring proper error propagation.
17 changes: 13 additions & 4 deletions packages/app-check/src/internal-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,19 @@ export async function getToken(
// count this as a failed attempt and use the backoff instead of
// retrying repeatedly with no delay, but any 3P listeners will not
// be hindered in getting the still-valid token.
interopTokenResult = {
token: token.token,
internalError: error
};
if (forceRefresh) {
// If forceRefresh is true, return the error alongside the token
// to propagate the failure properly.
interopTokenResult = {
token: token.token,
error
};
} else {
interopTokenResult = {
token: token.token,
internalError: error
};
}
} else {
// No invalid tokens should make it to this step. Memory and cached tokens
// are checked. Other tokens are from fresh exchanges. But just in case.
Expand Down