Open liamcharmer opened 5 months ago
Hi i've been trying to create a google chat space automated via server. I am trying to use service account to do this request here;
However it comes back with the error;
"this method doesnt support service account authentication/ Authenticate with a user account."
I have followed this hyperlink to create the service account and it says it can take up to 24 hours for changes. May this just be the case?
https://developers.google.com/workspace/chat/authenticate-authorize-chat-app
const { GoogleAuth } = require('google-auth-library'); const key = require('./service-account-key.json'); const chat = require('@googleapis/chat'); exports.createChatSpace = async (req, res) => { try { const scopes = [ 'https://www.googleapis.com/auth/chat.spaces.create', ]; // const scopes = ['https://www.googleapis.com/auth/chat.spaces']; const auth = new GoogleAuth({ credentials: key, scopes: scopes }); const authClient = await auth.getClient(); const chatClient = await chat.chat({version: 'v1', auth: authClient}); const response= await chatClient.spaces.setup({ requestBody: { space: { spaceType: 'SPACE', displayName: 'ASTEST', }, memberships: [ ] } }); res.status(200).send(response.data); } catch (error) { console.error('Error creating chat space:', error); res.status(500).send(error.message); } };
Having the same problem. I need a solution!
Hi i've been trying to create a google chat space automated via server. I am trying to use service account to do this request here;
However it comes back with the error;
"this method doesnt support service account authentication/ Authenticate with a user account."
I have followed this hyperlink to create the service account and it says it can take up to 24 hours for changes. May this just be the case?
https://developers.google.com/workspace/chat/authenticate-authorize-chat-app