Message Boards Message Boards

ServiceConnect for GoogleCalendar doesn't work

by default

ServiceConnect["GoogleCalendar"]

does not work, because Mathematica is not authorized. (I reported this as a bug already...)

I have been able to connect to the calendar using Python, and following the Google documentation.

However, I am wondering how I could pass a proper token. Here is a URL read that works:

token = Import["token.json", "RawJSON"]["token"];
url = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
headers = {"Authorization" -> "Bearer " <> token};
response = URLRead[HTTPRequest[url, <|"Headers" -> headers|>], "Body"]

Yet ServiceConnect["GoogleCalendar"] does not work, but I feel that it must be possible with

SecuredAuthenticationKey

but so far, I only get errors one way or another....

Any suggestion?

POSTED BY: Luc Barthelet
5 Replies

Any update on solving this issue? I got this message when logging in after calling:

ServiceConnect["GoogleCalendar", "New"]

Access blocked: wolfram.com has not completed the Google verification process *********@gmail.com wolfram.com has not completed the Google verification process. The app is currently being tested, and can only be accessed by developer-approved testers. If you think you should have access, contact the developer. If you are a developer of wolfram.com, see error details. Error 403: access_denied

POSTED BY: Istvan Zachar

Hi Luc,

I'm the developer currently maintaining our Wolfram Service Connections. I apologize for what you're experiencing atm. Google has updated its privacy policy and when I was refactoring our google related connections it triggered a new verification process for our underlying "web apps". I plan on addressing this issue in the short term.

If you have a registered and approved app in the Google Cloud Console, it is certainly possible to use your own Client ID and Client Secret with SercuredAuthenticationKey. However, I suggest you use URLRead with your already acquired token for the time being.

Best regards,

Juan

POSTED BY: Juan Leiva

Juan, Thank you for your answer. Can you show an example of Authenticating ServiceConnect with SecuredAuthenticationKey? I have failed to do so.

Thank you

POSTED BY: Luc Barthelet

If you have a valid app registered in the google cloud console, and a set of credentials, you can try this after making sure that "https://www.wolframcloud.com/objects/forms/oauth/verifier20/" is added to the list of valid redirect uris in your app:

googleKey =  "heregoesyourkey.apps.googleusercontent.com";
googleSecret = "GOCSPX-3-HERE-GOES-YOUR-SECRET";
googleSAK =
SecuredAuthenticationKey[<|"Name" -> "GoogleCalendar", 
"OAuthType" -> "ThreeLegged", "OAuthVersion" -> "2.0",
"ClientCredentials" -> <|"ConsumerKey" -> googleKey,
"ConsumerSecret" -> googleSecret|>,
"ResponseType" -> "code",
"Scopes" -> {"https://www.googleapis.com/auth/calendar", "https://www.googleapis.com/auth/calendar.readonly"}, 
"ScopeDelimiter" -> " ",
"VerifierInputFunction" -> Automatic, 
"AccessTokenURL" -> "https://www.googleapis.com/oauth2/v4/token", 
"UserAuthorizationURL" -> "https://accounts.google.com/o/oauth2/v2/auth"|>]

ServiceExecute["GoogleCalendar", "CalendarList",  Authentication -> googleSAK]

Unfortunately, support for refreshing access tokens (like google's case which expires after an hour) is yet to be properly handled. So, you will have to refresh your service connection each time your token expires. The plan to improve and optimize this is on the roadmap but will not be available as soon as I would like to promise you.

If there's any other inquiry, feel free to email me at juanl@wolfram.com,

Regards,

Juan

POSTED BY: Juan Leiva

I was going to create an Alexa skill today to integrate with ChatGPT for answering questions like "what's on our calendar this Friday?" but was blocked by this issue as well.

POSTED BY: Daniel Bigham
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract