I am trying to connect hangouts chat API with NodeJS but did not find any documentation related to Oauth in NodeJS, without which I can not connect to APIs. There is a code in Python but is there any thing in Node so that we can do the API call from front end it self.
Asked
Active
Viewed 224 times
1 Answers
0
The Oauth flow is the same for all Google APIs
- If there is a quickstart for a specific API in a specific language missing, you can use one from another API.
- For example, there is a Node.js quickstart for the Drive API
- You can take it as a base and have to modify only 2 things:
Modify
const SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly'];
by specifying the scopes you are going to use, for example
https://www.googleapis.com/auth/chat
For building the service, modify
const drive = google.drive({version: 'v3', auth});
to
const chat = google.chat({version: 'v1', auth});
- Mind that depending on the application, you might need to use a service account
- The documentaiton about implementing a service account in node.js can be found here

ziganotschka
- 25,866
- 2
- 16
- 33