We have seen the steps to connect with following oauth providers using Grails Oauth plugin in our previous posts:
Following are the simple steps to integrate Google plus in you grails application:
Step 1 : Install the Oauth plugin
Open BuildConfig.groovy and add the following dependency inside plugins section :
Step 2 : Sign up as Google developer and create a new application
Go to the link and complete the application form.
After successfully creating the app go to “APIs” sub-menu in “APIs & auth” menu and ON google+ API.
And go to “Credentials” menu and create new client id after that you got “Client ID” and “Client secret”.
Step 3 : Add Config values in Config.groovy
Add following code in you Config file:
NOTE:- http://localhost:8080/grailsOauthPluginDemo is my server URL, replace it with yours.
Step 4 : Add google link in your page
Add oauth:connect tag of oauth plugin tag library to create a link to Google+.
Step 5 : Add handler for google response
Final step is to create action to handle the response returned by the Google+ after successful authentication
You can get working code in the repository Grails Oauth Plugin Demo.
That’s all. Hope this helps. 🙂