Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Using the API with Authentication #69

@taf2

Description

@taf2

Browsing samples authentication appears to be ignored. So we get errors like the one below:

Error: Unexpected error while acquiring application default credentials: Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information.
    at GoogleAuth.<anonymous> (/Users/taf2/work/ctm-ai/node_modules/google-auth-library/build/src/auth/googleauth.js:235:31)
    at step (/Users/taf2/work/ctm-ai/node_modules/google-auth-library/build/src/auth/googleauth.js:47:23)
    at Object.next (/Users/taf2/work/ctm-ai/node_modules/google-auth-library/build/src/auth/googleauth.js:28:53)
    at fulfilled (/Users/taf2/work/ctm-ai/node_modules/google-auth-library/build/src/auth/googleauth.js:19:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

It might be nice to include examples that show how to exactly pass the API keys into the code so people don't have to guess...


Before you begin
Select or create a Cloud Platform project.

Go to the projects page

Enable billing for your project.

Enable billing

Enable the Google Cloud Speech API API.

Enable the API

Set up authentication with a service account so you can access the API from your local workstation.

from the README - takes me to pages that don't explain how to use the node.js API to authenticate....

Contrast that with examples from similar competing projects:

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/TranscribeService.html
http://voicebase.readthedocs.io/en/v3/how-to-guides/hello-world.html#how-to-get-your-bearer-token
https://console.bluemix.net/docs/services/watson/getting-started-tokens.html#tokens-for-authentication

I just think a few one liners, making this very obvious would help more people use this API with less friction to getting started...

this page for example doesn't help:
https://cloud.google.com/docs/authentication/getting-started#auth-cloud-implicit-nodejs

// Imports the Google Cloud client library.
const Storage = require('@google-cloud/storage');

// Instantiates a client. If you don't specify credentials when constructing
// the client, the client library will look for credentials in the
// environment.
const storage = new Storage();

// Makes an authenticated API request.
storage
  .getBuckets()
  .then((results) => {
    const buckets = results[0];

    console.log('Buckets:');
    buckets.forEach((bucket) => {
      console.log(bucket.name);
    });
  })
  .catch((err) => {
    console.error('ERROR:', err);
  });```

I don't see any thing in there about where to place an API key?

Metadata

Metadata

Labels

🚨This issue needs some love.api: speechIssues related to the googleapis/nodejs-speech API.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions