Professional Cloud Developer free question 10 / 10 · Domain 4: Integrating applications with Google Cloud services
A team calls a Google API with a standard API key that is not bound to a service account. A reviewer asks what the service can learn about the caller from that key. Which statement matches the Google Cloud documentation?
- The key ties the request to a project for billing and quota, and does not name a principal
- The key authenticates the default service account of the project, so IAM checks that account for the call
- The key identifies the developer who created it, so IAM checks the permissions of that user for the call
- The key is a JSON file that holds a private key that the application has to store securely
Show the answer and explanation
Answer: A
Why this is correct
There are two types of API keys: standard API keys and authorization keys. Both let you associate a request with a project for billing and quota purposes. A standard API key, which is not bound to a service account, does not identify a principal. Without a principal, the request can't use Identity and Access Management to check whether the caller is authorized to perform the requested operation. An authorization key is bound to a service account, and the request is processed as if that service account made it. The page cautions against using authorization keys in production for APIs that create or manage resources.
Why the other options are wrong
"The key authenticates the default service account of the project, so IAM checks that account for the call" … That describes an authorization key, which is bound to a service account. A standard key has not been bound to a service account.
"The key identifies the developer who created it, so IAM checks the permissions of that user for the call" … When a standard API key is used, the key does not identify a principal, and without a principal the request cannot use IAM to check authorization.
"The key is a JSON file that holds a private key that the application has to store securely" … API keys don't have an associated JSON file. The key is a string, and keeping it safe is a separate matter from what it authenticates.
Key point
A standard API key names a project, not a caller. Use a principal such as a service account when IAM must decide.