Skip to content
Open
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
22 changes: 22 additions & 0 deletions auth/src/desktop/rpcs/auth_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@
#include <string>

#include "app/src/app_common.h"
#include "app/src/function_registry.h"
#include "app/src/heartbeat/heartbeat_controller_desktop.h"
#include "app/src/include/firebase/app.h"
#include "app/src/include/firebase/future.h"
#include "app/src/include/firebase/internal/mutex.h"
#include "auth/src/desktop/auth_desktop.h"
#include "auth/src/include/firebase/auth.h"
#include "firebase/log.h"

namespace {
const int kAppCheckTokenTimeoutMs = 10000;
} // namespace

namespace firebase {
namespace auth {

Expand All @@ -50,6 +56,22 @@ AuthRequest::AuthRequest(::firebase::App& app, const char* schema,
}
}
}

// Add AppCheck attestation token if available.
// This is required when AppCheck enforcement is enabled on the project.
::firebase::internal::FunctionRegistry* registry = app.function_registry();
if (registry) {
Future<std::string> app_check_future;
bool succeeded = registry->CallFunction(
::firebase::internal::FnAppCheckGetTokenAsync, &app, nullptr,
&app_check_future);
if (succeeded && app_check_future.status() != kFutureStatusInvalid) {
const std::string* token = app_check_future.Await(kAppCheckTokenTimeoutMs);
if (token && app_check_future.error() == 0 && !token->empty()) {
add_header("X-Firebase-AppCheck", token->c_str());
}
}
}
Comment thread
lalmstrom marked this conversation as resolved.
}

std::string AuthRequest::GetUrl() {
Expand Down
1 change: 1 addition & 0 deletions release_build_files/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ code.
- Changes
- General (iOS, tvOS, Desktop): iOS, tvOS, and macOS SDKs are now built
using Xcode 26.2.
- Auth (Windows): Fixes Auth requests when Appcheck is enabled.

### 13.7.0
- Changes
Expand Down
Loading