Hi guys I have some code in my grails 2.3.4\'s controller\'s action that uses google java client libraries to access the OAuth2 api. But when I create an instance of GoogleA
Okey I've found the solution.
When you create new LocalServerReceiver()
use instead new LocalServerReceiver.Builder().setPort(9089).build()
I've chosen some empty port in this case 9089. Actually LocalServerReceiver
is a http server that listens to google and google sends code
param to this server. Now all you have to do is create a new entry in your Redirected URIs which is in this case as follows: http://localhost:9089/Callback
. Note the port number is same as I've used in the code while building the server using LocalServerReceiver.Builder()
class.
And voila!!! you got the access_token and refresh_token from the google.
Happy coding... Happy Java clients...