Skip to content

Commit dcb99ff

Browse files
committed
[vertexai] Include appcheck token unconditionally
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.
1 parent a00c310 commit dcb99ff

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ 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 appcheck backend can differentiate between apps without appcheck, and wrongly
104+
// configured apps by verifying the value of the token, so it always needs to be included.
105+
headers["X-Firebase-AppCheck"] = token.token
105106
}
106107

107108
if (internalAuthProvider == null) {

0 commit comments

Comments
 (0)