Search code examples
pythongoogle-app-enginegoogle-apps

How to see if domain is using Google Apps with Python


Within my Python GAE application I need to know if a user's domain is a Google Apps domain. Until now I've been sending a request to https://www.google.com/a/domainName/ServiceLogin. If the response had "Sorry, you've reached a login page for a domain that isn't using Google Apps" included, the domain was not using Google Apps. However, recently I noticed that this method doesn't seem to work anymore. Do any alternative methods exist?

Thanks


Solution

  • Include email in the list of scopes you request from the user. In the response token there will be an hd parameter if it's a Google Apps account.