Dialogflow easy way for authorization

后端 未结 5 922
孤独总比滥情好
孤独总比滥情好 2020-12-02 00:05

Does exist an easy way to connect Dialogflow agent to node.js code? When I use this code with the correct projectID taken from the Dialogflow agent\'s settings

5条回答
  •  感动是毒
    2020-12-02 00:41

    It is not very well documented, but the easiest way to authenticate is using the JSON file provided on your google cloud platform console.

    const sessionClient = new dialogflow.SessionsClient({
        keyFilename: '/path/to/google.json'
    });
    const sessionPath = sessionClient.sessionPath(projectId, sessionId);
    

    This also works for all the other clients. ContextsClients, EntityTypesClient and so on.

提交回复
热议问题