Include Multi Scope Tests When Generating Service Account Credentials #8972
djaquels
started this conversation in
Show and tell
Replies: 1 comment 3 replies
-
This looks like a bug to me, the AIP for service account credentials says scopes should be separated by spaces: https://google.aip.dev/auth/4117 Thanks for letting us know. I will send a PR to fix the problem. I would like to understand what you mean by "it crashes the program". I would expect that it creates credentials that are unusable, but no crashes. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For Service Account credentials generation test
There is the following var for testing oauth scopes:
ScopedEnvironment adc_env_var(GoogleAdcEnvVar(), filename.c_str());
auto creds = CreateServiceAccountCredentialsFromDefaultPaths(
{{"https://www.googleapis.com/auth/devstorage.full_control"}},
"[email protected]");
But there is no doc neither examples on how to use the scopes param when using multiple scopes.
For example, the following doesn't work, it crashes the program.
auto creds = CreateServiceAccountCredentialsFromDefaultPaths(
{{"https://www.googleapis.com/auth/devstorage.full_control","https://www.googleapis.com/auth/cloud-platform"}},
"[email protected]");
But the following snippet does work, it generates the credentials and can be used for authentication, in other words using a single string line with the scopes separated by a space, in contrast to an array of string as intuitively may be thought.
auto creds = CreateServiceAccountCredentialsFromDefaultPaths(
{{"https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/cloud-platform"}},
"[email protected]");
Beta Was this translation helpful? Give feedback.
All reactions