1

I believe there is an undocumented Google API available to create and manage Google Cloud Console (and App Engine) projects on behalf of third party users.

Does anyone know how to use it?

I think older versions of the Google Eclipse Plugin obtained an OAuth2 token in the (undocumented) scope https://www.googleapis.com/auth/appengine.admin, and this allowed it to generate a Cloud Console project on your behalf. The latest version doesn't seem to do this. App Engine's own appcfg.py also uses this scope, but doesn't seem to do much more than deploy the code - I'm looking to change core settings for the project, such as Name, Redirect URLs, and Web Origins.

Any information would be appreciated.

I maintain a WordPress plugin providing secure Google Apps Login for end users, and currently have to give detailed instructions to admins for creating a new Cloud Console project manually, and entering settings such as Redirect URL. Ideally, I would create a simple on-line service to do all of this for them.

Thank you!

Dan Lester
  • 89
  • 1
  • 8
  • did you find the answer to this? i am also convinced of its existence, as cloud ides such as codenvy and devtable request an oauth2 scope which appears as "View and manage your applications deployed on Google App Engine" in the oauth2 dialog, then as "Has access to Google App Engine Admin Console" from your security profile page. – Gwyn Howell Feb 11 '14 at 10:24
  • @GwynHowell No answer, despite trying to approach a few Google people... Older versions of the Google Eclipse Plugin definitely created projects on behalf of the user, but the latest version doesn't, so I wonder if Google are trying to stop the API being used really. I also tried looking through the Google Eclipse Plugin source code to see if that would give any clues, but the source code isn't readily available - i.e. that available on the web is not clear which version it is, and it doesn't compile! Let me know if you get anywhere too! – Dan Lester Mar 03 '14 at 16:34
  • sure thing - thanks for the update. if i find anything i'll update this post – Gwyn Howell Mar 03 '14 at 16:36
  • In my opinion, the lack of an API to create projects is an intentional decision on Google's part, for the same reason that there is no API to create a new Gmail account: protecting against abuse. What's to abuse in the Developer Console? Plenty! Service accounts (free 15GB of Drive storage), additional API quota, App Engine free tier, and many other things... – kiwidrew Jan 24 '15 at 14:20

1 Answers1

0

It is possible to programmatically create a new Developer Console project on behalf of a Google Account (yes, you read that right). You do so in a very roundabout way:

  1. Request the https://www.googleapis.com/auth/drive.scripts scope from the user (standard OAuth 2.0 flow).
  2. Use the Drive API's drive.insert method to create a new file with a mimetype of application/vnd.google-apps.script.
  3. Somehow try to get the project ID, maybe by uploading some Apps Script code? This is the part that I was never able to figure out.

A little known fact is that every Google Apps Script project has a hidden Developer Console project associated with it. This project is not shown in the list of projects, but it does exist. It is created automatically when the user starts a new Apps Script project, and the drive.insert method is enough to cause this to happen.

How do you get to the hidden project? Well, the only way I know of is to open the Apps Script project from the Drive website, open the "Resources > Advanced Google Services" dialog, and click the link to the Developer Console. You'll find the project ID in the URL.

Aside from not being shown in your list of projects and not being able to use App Engine, this is a normal Developer Console project. You can add additional OAuth client credentials, service accounts, Compute Engine instances, etc. And of course once you have a project ID, all of the various management APIs will work: creating new virtual machines, making use of a service account's impersonation ability, etc.

kiwidrew
  • 3,063
  • 1
  • 16
  • 23