Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement google oauth in cakephp using cakedc/users?

I am trying to add a login layer using CakeDC/users plugin using linkedin and google. The linkedin login is working fine, but I am not able to figure out google login. Followed everything in the tutorial login with google oauth

I am getting a code parameter in url returned from google/auth but the value of a parameter authuser is returned as 0.

On developers.google site I found that if code parameter is being returned the app is authenticated.

No user is being added to the users table as well as no change takes place in social_accounts table as well and a flash message is displayed as 'You are not authorized to access that location.'

like image 632
Sushant Avatar asked Nov 08 '22 22:11

Sushant


1 Answers

In order to get Google OAuth working you need to generate an OAuth 2.0 Client ID under credentials (https://console.developers.google.com/).

Then you need to enable Google+ API under Control Panel (This is the step you probably missed). If you don't enable the API, Google won't return user details and you will experience the behavior you described.

like image 70
ajibarra Avatar answered Nov 27 '22 15:11

ajibarra