Skip to content

Commit

Permalink
[vertexai] Include appcheck token unconditionally (firebase#6409)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
rlazo and rachelsaunders authored Oct 24, 2024
1 parent d96507b commit ec48742
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion firebase-vertexai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Unreleased
* [fixed] Fixed issue where Firebase App Check error tokens were unintentionally missing from the requests. (#6409)


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

Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ internal constructor(

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

if (internalAuthProvider == null) {
Expand Down

0 comments on commit ec48742

Please sign in to comment.