Google API OAuth2, Service Account, “error” : “invalid_grant”

After some investigations I found, that Google API does not work as expected with your personal account @gmail.com. You should have organization domain account in Google in format you@your_organisation_domain Then, what is also pretty confusing, there is documentation at Google Drive API page, with “Delegate domain-wide authority to your service account” section not mentioned at … Read more

How can I find the Event Id of my Google Calendar event?

On The Google Calendar Website Since he originally asked how to click into the calendar and find the ID of a particular event, and since that’s what I needed to know how to do too: Click the event in your Google Calendar. It will take you to a page with a URL such as https://calendar.google.com/calendar/render?pli=1#eventpage_6%7Ceid-NGh0Z3BtbTFobWFrNzQ0cjBrYmtkY29kYXIgZXVndTlrYW4xZGRpMXBtaTZzazNpYjWoNmdAZw-1-0- … Read more

How do I set return_uri for GoogleWebAuthorizationBroker.AuthorizeAsync?

You can use this code: (original idea from http://coderissues.com/questions/27512300/how-to-append-login-hint-usergmail-com-to-googlewebauthorizationbroker) dsAuthorizationBroker.RedirectUri = “my localhost redirect uri”; UserCredential credential = await dsAuthorizationBroker.AuthorizeAsync(… dsAuthorizationBroker.cs using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Google.Apis.Auth.OAuth2; using Google.Apis.Auth.OAuth2.Flows; using Google.Apis.Auth.OAuth2.Requests; using Google.Apis.Util.Store; namespace OAuth2 { public class dsAuthorizationBroker : GoogleWebAuthorizationBroker { public static string RedirectUri; public new static async Task<UserCredential> … Read more

Google API Client “refresh token must be passed in or set as part of setAccessToken”

I got the same problem recently and i solved it with this. <?php $client->setRedirectUri($this->_redirectURI); $client->setAccessType(‘offline’); $client->setApprovalPrompt(‘force’); I explain ….. Refresh token is not returned because we didnt force the approvalPrompt. The offline mode is not enought. We must force the approvalPrompt. Also the redirectURI must be set before these two options. It worked for me. … Read more

Creating Google Calendar events with a GCP Service Account

Answer: You need to enable the APIs and provide scopes in three places: in your auth code, in the GCP console, and the Google Admin console. More Information: As I explained in the comments, the code you have provided should run without issue. The Insufficient Permission: Request had insufficient authentication scopes. error is a result … Read more

Getting events from calendar

That code above is pretty awful (and it does not seem to work in ICS – definitely the column names are different) The page here: http://developer.android.com/guide/topics/providers/calendar-provider.html provides a much better overview. A (much) simpler code to retrieve calendars: public class CalendarContentResolver { public static final String[] FIELDS = { CalendarContract.Calendars.NAME, CalendarContract.Calendars.CALENDAR_DISPLAY_NAME, CalendarContract.Calendars.CALENDAR_COLOR, CalendarContract.Calendars.VISIBLE }; public … Read more