Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How do you read the scopes associated with an API key's product?

Not applicable

I see from the VerifyAPIKey docs that the variable verifyapikey.{policy_name}.app.scopes gets populated with the scopes associated with the API key's products. Thats exactly what I need, however I can't figure out how to read this from javascript.

print(typeof scopes)
>> object
print(scopes.length)
>> 0
print(scopes.toString())
>> [Ljava.lang.String;@3b9903d5
print(scopes[0])
>> undefined

The product I have associated with the developer app has a scope of "testscope" setup so I expect to get an array with one item in it. It looks like I'm being given a Java array and I'm not sure how to access this from the Javascript.

How can I access the scopes associated with an API key?

1 2 768
2 REPLIES 2