Spring Social Google contains bindings to Google Plus, Google Tasks and Google Drive APIs, and allows you to use any Java client library for any Google API while using Spring Social for authentication and connection management.
Project on GitHub: https://github.com/GabiAxel/spring-social-google
Distribution bundle: https://github.com/GabiAxel/spring-social-google/releases/tag/1.0.0.RELEASE
Reference manual: http://gabiaxel.github.io/spring-social-google-reference/
JavaDoc: http://gabiaxel.github.io/spring-social-google-javadoc/
Example application: https://github.com/GabiAxel/spring-social-google-example
To use with Maven add the following code to your POM:
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-google</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
Creating a Google Cloud Project and Using it with Spring Social Google
Navigate to https://console.developers.google.com/project
Click "Create Project" and enter a name and ID for the project.
Enter the project and in the left menu select "APIs & Auth". In "APIs" activate the APIs you want to use in the application. The example application uses Google+ API and Tasks API.
In the left menu go to "Credentials" and click "Create new client ID". For "Application Type" choose "Web Application" and for "Authorized Redirect URI" enter "http://localhost:8080/signin/google".
The new set of credentials will be added. Note the "Cliend ID" and "Client Secret" values - we will use them when running the example application.
Get the example application from GitHub:
git clone git://github.com/GabiAxel/spring-social-google-example.git
Enter the application directory and run it with Tomcat (replace CLIENT_ID and CLIENT_SECRET with the values you saw in Google Developers Console):
cd spring-social-google-example
mvn tomcat7:run \
-Dgoogle.clientId=CLIENT_ID \
-Dgoogle.clientSecret=CLIENT_SECRET
The application will run at http://localhost:8080/
The Road Ahead
There is no shortage of Google APIs. My current though is to proceed to YouTube and Calendar, but I really want to know what you want, so please submit your requests and issues in the GitHub project.
Enjoy using Spring Social Google!
Hi, I encounter a question described here: http://stackoverflow.com/questions/19499827/how-to-add-google-oauthspring-social-google-to-the-existing-spring-project-usi
ReplyDeleteCould you check about it.
Great work Gabriel, Thank you!
ReplyDeleteHi Gabriel, Thanks for the great framework. The unfortunate part is I am unable to integrate your code into my existing Spring-MVC project. I am only looking for Google+ login. I tried Scribe but without success. What I require is I call a method in the Controller, which redirects the user to Google page, and then once the user authorizes, I have basic information like Email, Profile Photo in the backend. Next time the user should be able to click it again and Login, if not then the user will be registered with that account. I dont have any main class, and have mostly XML based configuration. Your project is vast to extract specifically what I want and use, pheraps you can help me filter out to what I need. Thanks a lot. Please feel free to email me at kernelfreak[at]gmail.com. Thanks.
ReplyDeleteIf all you need is Google+ sign in, I recommend doing it like so: https://developers.google.com/identity/sign-in/web/
ReplyDeleteSpring Social Google and similar libraries are suitable when you need to work with the Google APIs on the server side.
Is there any way I can do this in Java, I might require some API's in future. Thanks.
DeleteAnd I also want to learn.
DeleteThen you should refer to the official Spring Social documentation. Though it doesn't contain examples with Google, you should get the idea. Also take a look at the example application with Google here: https://github.com/GabiAxel/spring-social-google-example
Deletehow to share messages in google plus using spring social?
ReplyDelete