Skip to content

Commit ec48742

Browse files
[vertexai] Include appcheck token unconditionally (#6409)
The app check backend can differentiate between apps that do not use appcheck at all, and those sending invalid data, by using a special placeholder token when errors happen. We were previously not including the token value in error cases, but we should. --------- Co-authored-by: rachelsaunders <[email protected]>
1 parent d96507b commit ec48742

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

firebase-vertexai/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
2+
* [fixed] Fixed issue where Firebase App Check error tokens were unintentionally missing from the requests. (#6409)
23

34

45
# 16.0.1
@@ -55,4 +56,3 @@
5556
* [feature] Added support for `responseMimeType` in `GenerationConfig`.
5657
* [changed] Renamed `GoogleGenerativeAIException` to `FirebaseVertexAIException`.
5758
* [changed] Updated the KDocs for various classes and functions.
58-

firebase-vertexai/src/main/kotlin/com/google/firebase/vertexai/GenerativeModel.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ internal constructor(
9999

100100
if (token.error != null) {
101101
Log.w(TAG, "Error obtaining AppCheck token", token.error)
102-
} else {
103-
headers["X-Firebase-AppCheck"] = token.token
104102
}
103+
// The Firebase App Check backend can differentiate between apps without App Check, and
104+
// wrongly configured apps by verifying the value of the token, so it always needs to be
105+
// included.
106+
headers["X-Firebase-AppCheck"] = token.token
105107
}
106108

107109
if (internalAuthProvider == null) {

0 commit comments

Comments
 (0)