googleapis / googleapis/google-cloud-node

Unable to set Display Name and Restrictions for API Key

Open
#5,087 0 comments 0 reactions 1 assignee Claimed by @sofisl View on GitHub
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

Thanks for stopping by to let us know something could be better!

**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

- Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
- Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
- Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting
- Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq

If you are still having issues, please be sure to include as much information as possible:

#### Environment details

- which product (packages/*): @google-cloud/apikeys
- OS: Mac Sonoma 14.2
- Node.js version: v21.6.2
- npm version: 10.2.4
- google-cloud-node version: ^1.1.0

#### Steps to reproduce

Make a basic request using the `createKey` method and include restrictions and a display name:

```
const data = {
display_name: name,
restrictions: restrictions
}
const request = {
parent: parent,
apiKey: data
};

const [response] = await apikeysClient.createKey(request);
console.log(`Created API key: ${response.name}`);

```

Example data:

`{"display_name":"","restrictions":{"api_targets":[{"service":"","methods":["POST","GET","PUT","DELETE"]}]}}`

Resulting key:
Screenshot 2024-02-26 at 10 16 04 AM

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.