Skip to Content
0
Jul 15, 2020 at 10:06 PM

Authenticate to Google API via OAuth 2.0 from CAI

515 Views

Hello,

I'm creating a bot that needs access to a specific Google Calendar account (not an account per end-user of the bot).

I've been able to implement the GET operations (e.g. reading a list of public events in my calendar) successfully using an API key provided by Google.

However, I have so far been unsuccessful at getting POST operations (e.g. creating a new event) to work. For these, it is required to authenticate via OAuth2.

  • I have setup the application in the Google Developer console and activate the corresponding Google Calendar API.
  • I have created OAuth 2.0 credentials, which gives my a client ID and a client secret.
  • I have put "https://api.cai.tools.sap" as the redirect URL in the configuration of the OAuth 2.0 credentials in Google Developer console but I'm unsure if this is correct.
  • I have created an authentication template in my SAP CAI bot set to mode "OAuth2 Authentication" and supplied the client ID and the client secret and the authorization URL https://accounts.google.com/o/oauth2/v2/auth

However, this is not working. When trying this skill and activating debug mode, I get:

Warning: An API error has been detected on

"Error while calling API"

Which steps are missing or which settings are incorrect to enable this to work?

Many thanks and best regards

Patrick