Skip to content

Auth error:Error: invalid_grant on windows 7 #2455

@svsh227

Description

@svsh227

I am using @google-cloud/speech but while doing node app.js I am getting Auth error: Error: invalid_grant.
I am searching on google but I couldn't get my solutions. Please tell me how to remove this error.
My code is:

const Speech = require('@google-cloud/speech')({
  projectId: 'natural-numbus-123456789',
  keyFilename: './myman-123456789.json'
});
process.env.GOOGLE_APPLICATION_CREDENTIALS = './myman-123456789.json'
const projectId = 'natural-numbus-123456789';
const fileName = "gs://cloud-samples-tests/myman/brooklyn.flac";
const options = {
  encoding: 'FLAC',
  sampleRateHertz: 16000,
  languageCode: 'en-US'
};
Speech.recognize(fileName, options)
  .then((results) => {
    console.log(results);
    const transcription = results[0];
    console.log(`Transcription: ${transcription}`);
  })
  .catch((err) => {
    console.error('ERROR:', err);
  });

On linux its working fine. But on windows i got error.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions