From eeb1ff7b51d77fe5a3be4a29d686a194b19c1256 Mon Sep 17 00:00:00 2001 From: "A. Cody Schuffelen" Date: Mon, 4 Nov 2024 18:27:37 -0800 Subject: [PATCH] Use a common build api scope string --- base/cvd/cuttlefish/host/commands/cvd/fetch/fetch_cvd.cc | 2 +- base/cvd/cuttlefish/host/libs/web/credential_source.cc | 5 +---- base/cvd/cuttlefish/host/libs/web/credential_source.h | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/base/cvd/cuttlefish/host/commands/cvd/fetch/fetch_cvd.cc b/base/cvd/cuttlefish/host/commands/cvd/fetch/fetch_cvd.cc index cf2a8285cd..7fdf11eb6f 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/fetch/fetch_cvd.cc +++ b/base/cvd/cuttlefish/host/commands/cvd/fetch/fetch_cvd.cc @@ -349,7 +349,7 @@ Result> GetBuildApi(const BuildApiFlags& flags) { std::chrono::milliseconds(5000)); std::vector scopes = { - "https://www.googleapis.com/auth/androidbuild.internal", + kAndroidBuildApiScope, "https://www.googleapis.com/auth/userinfo.email", }; Result> cvd_creds = diff --git a/base/cvd/cuttlefish/host/libs/web/credential_source.cc b/base/cvd/cuttlefish/host/libs/web/credential_source.cc index 02d2cbe647..c641a1f93f 100644 --- a/base/cvd/cuttlefish/host/libs/web/credential_source.cc +++ b/base/cvd/cuttlefish/host/libs/web/credential_source.cc @@ -42,9 +42,6 @@ namespace cuttlefish { namespace { -constexpr char kBuildScope[] = - "https://www.googleapis.com/auth/androidbuild.internal"; - constexpr auto kRefreshWindow = std::chrono::minutes(2); // Credentials with known expiration times with behavior to load new @@ -159,7 +156,7 @@ std::unique_ptr TryParseServiceAccount( return {}; } auto result = ServiceAccountOauthCredentialSource::FromJson( - http_client, content, kBuildScope); + http_client, content, kAndroidBuildApiScope); if (!result.ok()) { LOG(DEBUG) << "Failed to load service account json file: \n" << result.error().FormatForEnv(); diff --git a/base/cvd/cuttlefish/host/libs/web/credential_source.h b/base/cvd/cuttlefish/host/libs/web/credential_source.h index 5410a26482..03930730d8 100644 --- a/base/cvd/cuttlefish/host/libs/web/credential_source.h +++ b/base/cvd/cuttlefish/host/libs/web/credential_source.h @@ -23,6 +23,9 @@ namespace cuttlefish { +constexpr char kAndroidBuildApiScope[] = + "https://www.googleapis.com/auth/androidbuild.internal"; + class CredentialSource { public: virtual ~CredentialSource() = default;