How To Constrains Google OAuth To A Specific Google Apps Domain

221 Views Asked by At

I have a Java web application that uses Google OAuth for authentication (with this API : http://goo.gl/6wWyT3) and it works fine. However, I need a way to allow only users from a certain Google Apps for Education domain e.g [email protected] to be able to gain access to the app using Google's OAuth. How do I go about this ??

1

There are 1 best solutions below

4
On

send users off to Google with a parameter hd=<domain.com> in the authorization request (by modifying buildLoginUrl) to skip the account chooser screen and upon return, check that the claims returned from Google contain the hd claim with a value <domain.com> in getUserInfoJson to enforce the access requirement