Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set Display Name and Restrictions for API Key #5087

Open
sam-parks opened this issue Feb 26, 2024 · 0 comments
Open

Unable to set Display Name and Restrictions for API Key #5087

sam-parks opened this issue Feb 26, 2024 · 0 comments
Assignees

Comments

@sam-parks
Copy link

sam-parks commented Feb 26, 2024

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 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":

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":"<DISPLAY_NAME>","restrictions":{"api_targets":[{"service":"<SERVICE_NAME>","methods":["POST","GET","PUT","DELETE"]}]}}

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants