I am using the Google documents list api for .net V3(dll version 2.0.1.0). I am using client login authentication as described in this link https://developers.google.com/google-apps/documents-list/#authorizing_requests_with_clientlogin
How can i determine if its a Google apps account or a normal Google account?
Thanks, Bharath
I don't think there is a very good way to check if an account is a Google Apps account.
Checking if the email is different than @gmail.com won't work because it is possible to create Google accounts with existing emails addresses.
The only way I'm thinking of is to check the Domain's DNS MX records and see if some service of the domain are served by Google Apps servers (like email served from gmail etc...) but even there you might have to check more than one service because some Google Apps companies deactivate Gmail for instance (or some other service) to use a custom solution instead.
Google consumer accounts are
@gmail.com
or rarely@googlemail.com
, the rest will be Google Apps accounts.Assuming you included:
in your OAuth scopes, you can make a request to:
If it's a Google Apps account, an "hd" parameter (Hosted Domain?) will be returned by the call with the Google Apps domain as it's value. If it's a consumer account, whether it's @gmail.com or even a potential "conflicting account", the hd parameter will not be returned. See my example below. admin@jay.powerposters.org is a Google Apps Account while consumer@jay.powerposters.org is a consumer account. If I created a consumer user in the Google Apps domain it wouuld become a conflicting account and the consumer account would be pushed out of the @jay.powerposters.org namespace but that hasn't happened yet.
For admin@jay.powerposters.org:
For consumer@jay.powerposters.org:
If your goal is to check whether an user has access to a given functionality you can send a request to the Metadata feed and check the
<docs:feature>
elements.For instance, a feature with
<docs:featureName>upload_any</docs:featureName>
indicates that the user can upload any kind of documents:https://developers.google.com/google-apps/documents-list/#getting_general_information_about_a_users_account