Skip to content

Commit 2bbbc51

Browse files
authored
Don't send dummy App Check token to functions endpoint (#5418)
1 parent 4a47968 commit 2bbbc51

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/functions/src/context.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,12 @@ export class ContextProvider {
122122
async getAppCheckToken(): Promise<string | null> {
123123
if (this.appCheck) {
124124
const result = await this.appCheck.getToken();
125-
// If getToken() fails, it will still return a dummy token that also has
126-
// an error field containing the error message. We will send any token
127-
// provided here and show an error if/when it is rejected by the functions
128-
// endpoint.
125+
if (result.error) {
126+
// Do not send the App Check header to the functions endpoint if
127+
// there was an error from the App Check exchange endpoint. The App
128+
// Check SDK will already have logged the error to console.
129+
return null;
130+
}
129131
return result.token;
130132
}
131133
return null;

0 commit comments

Comments
 (0)