Wednesday, 21 November 2012

Google Yahoo Login Using OAuth 2.0 in Java Servlets

This script
- authenticates users on your website using their Google or Yahoo account.
- pulls the user details from its Google/Yahoo account and displays the same on your webpage.
- you may store these details in your database.
- has logout facility and uses Java servlets.

Download Pack     Live Demo    

How to use:

The download pack contains the complete project structure with the sample war file that I have deployed in my live demo.

Web.xml (Input variables)

In your web.xml update your domain name value for the context parameter webDomainName. If you change your war file name, update its value under the context parameter warFileName. Then build your war file with the same name and deploy it under your domain.

So if your webDomainName is "" and your warFileName is "MyLoginApp" then your application URL should be "" which will display the login page ie index.html.

After successful login welcome.jsp will be shown to the user.

Welcome.jsp (Output variables)

The user account details will be available as session attributes in welcome.jsp
The object gyUser contains the user attributes as shown. You may write your own display code instead, as required.

Let me know if you face any issues.


  1. how to get the friends list of logged person

  2. sad to say but it doesn't work for me...

  3. Please check your demo link, google response below exception.

    org.expressme.openid.OpenIdException: Bad response code: 404

  4. Still some of the Gmail users remain unresolved with their issues hence in order to support all of those Gmail users we provide Gmail Customer Service Phone Number 1-844-780-6766 which anyone can call anywhere from the world to resolve their Gmail related issues. Some of the major issues of Gmail which we resolve regularly on our Phone calls are listed below:-