fix: Pass scope through when getting metadata-based access tokens
This commit is contained in:
1 parent
dcdf7cddbf
commit
48c689aa93
4 files changed
+21
-3
No files matched your search
@@ -75,7 +75,7 @@ module Google
|
||||
GCECredentials.unmemoize_all
|
||||
raise NOT_FOUND_ERROR
|
||||
end
|
||||
GCECredentials.new
|
||||
GCECredentials.new scope: scope
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -85,7 +85,8 @@ module Google
|
||||
c = options[:connection] || Faraday.default_connection
|
||||
retry_with_error do
|
||||
uri = target_audience ? COMPUTE_ID_TOKEN_URI : COMPUTE_AUTH_TOKEN_URI
|
||||
query = target_audience ? { "audience" => target_audience, "format" => "full" } : nil
|
||||
query = target_audience ? { "audience" => target_audience, "format" => "full" } : {}
|
||||
query[:scopes] = Array(scope).join " " if scope
|
||||
headers = { "Metadata-Flavor" => "Google" }
|
||||
resp = c.get uri, query, headers
|
||||
case resp.status
|
||||
|
||||
Reference in new issue
Block a user