Create an API Project at https://code.google.com/apis/console while logged in as your superadmin account for your apps domain (honestly I’m not sure if it matters which user account you create the project with but it doesn’t hurt to be consistent here just in case).

Go to the API Access section.

Create an OAuth 2 client named “whatever you want” at “https:// wherever you want; it doesn’t matter for this scenario”.

Note that you don’t need to specify an icon and that the name of your client doesn’t matter as no other living soul (a.k.a. end-user in your apps domain) will ever see it.

Add the client ID ( somenumberhere.apps.googleusercontent.com ) from step #4 and specify “https://www.google.com/calendar/feeds/" for your scope (assuming you want to work with Calendar API) and click Authorize.

For other APIs, list the proper scopes here, comma-delimited. I just need Calendar API and this works for me. Be sure to specify https , not just http.

Now you should have a properly set-up apps domain and API project and the two
are linked together. Let’s move on now to your .NET code that will be your
task/service that runs in the background on behalf of your users in your apps
domain. Firstly, I do not recommend using the open-source Google client
library for .NET. I’ve had bad experiences with it, namely that it has been
known to leak memory. The issue I reported with them on this matter was
claimed to be resolved but I haven’t been back to check it out. I had to make
progress on my project and waiting for them to resolve the issue was not an
option. I wrote my own T4 template (Visual Studio code generator) to generate
a client library for Google (and other RESTful APIs which use OAuth 1.0 or
2.0) that has no memory leaks and is both ridiculously fast and efficient:
https://github.com/JamesDunne/RESTful.tt. It supports both synchronous and
asynchronous methods of I/O. Its code is up to date as of 2012-11-12. Check
out the project locally and open the TestClient project’s Program.cs file.
This is a simple console application designed to demonstrate the simplicity of
the code-generated API client for Google and using OAuth 1.0 for shared-secret
authentication.

NOTE: This test program is specific to Google Calendar. If you are working
with a different API, you’ll have to edit the RESTful/Google/Restful.tt T4
template to declare the API methods you need access to. It couldn’t hurt to
define some Newtonsoft.Json-enabled classes to deserialize the response data
to. For Google Calendar API testing, simply paste in the values from your API
Console ( client ID and client secret ) into the new OAuth10("
**myclientidhere**.apps.googleusercontent.com", " **mysecretkeyhere** ")
expression. Then paste in an actual user provisioned in your domain into the
client.GetMyCalendarList(null, null, null, /*requestorID:*/ "
**username@example.com** ") expression. Run the program and you should see a
raw JSON dump of the response retrieved from Google. For example, I get this
output (id and summary are sanitized):