Google oauth2 api client is not working properly

坚强是说给别人听的谎言 提交于 2019-11-30 22:18:43

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...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!