googlesamples / assistant-sdk-nodejs

Apache License 2.0
93 stars 27 forks source link

Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: invalid_client #1

Open itachiRedhair opened 6 years ago

itachiRedhair commented 6 years ago

In the project credentials are retrieved from home directory as follows:

const homedir = require('homedir');
const deviceCredentials = require(`${homedir()}/.config/google-oauthlib-tool/credentials.json`);

What I am trying to do is populating deviceCredentials Directory in the code itself:

const deviceCredentials = {
  client_secret: 'xxxxxxxxxxx',
  refresh_token: 'xxxxxxxxxxx',
  scopes: ['https://www.googleapis.com/auth/assistant-sdk-prototype'],
  client_id: 'xxxxxxxxxxxxxxx',
  token_uri: 'https://accounts.google.com/o/oauth2/token',
};

I am getting following error:

Auth error:Error: invalid_client
{ Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: invalid_client
    at Object.exports.createStatusError (/home/akshay/Desktop/Workspace/assistant-sdk/remoteAssistant/node_modules/grpc/src/common.js:87:15)
    at ClientDuplexStream._emitStatusIfDone (/home/akshay/Desktop/Workspace/assistant-sdk/remoteAssistant/node_modules/grpc/src/client.js:235:26)
    at ClientDuplexStream._receiveStatus (/home/akshay/Desktop/Workspace/assistant-sdk/remoteAssistant/node_modules/grpc/src/client.js:213:8)
    at Object.onReceiveStatus (/home/akshay/Desktop/Workspace/assistant-sdk/remoteAssistant/node_modules/grpc/src/client_interceptors.js:1290:15)
    at InterceptingListener._callNext (/home/akshay/Desktop/Workspace/assistant-sdk/remoteAssistant/node_modules/grpc/src/client_interceptors.js:564:42)
    at InterceptingListener.onReceiveStatus (/home/akshay/Desktop/Workspace/assistant-sdk/remoteAssistant/node_modules/grpc/src/client_interceptors.js:614:8)
    at /home/akshay/Desktop/Workspace/assistant-sdk/remoteAssistant/node_modules/grpc/src/client_interceptors.js:1110:18
  code: 14,
  metadata: Metadata { _internal_repr: {} },
  details:
   'Getting metadata from plugin failed with error: invalid_client' }
Error: Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: invalid_client
    at getAssistantResponse (/home/akshay/Desktop/Workspace/assistant-sdk/remoteAssistant/server.js:34:11)
Fleker commented 6 years ago

How are you obtaining the deviceCredentials values? There may be an issue with how you obtained the client_id.

jawwadturabi commented 5 years ago

have you solve this issue?