CakeDC / users

Users Plugin for CakePHP
https://www.cakedc.com
Other
521 stars 296 forks source link

Never success login to google. Error 400: redirect_uri_mismatch. #970

Closed wawanabnan closed 2 years ago

wawanabnan commented 2 years ago

I would like to make social login using google oAuth and follow the instruction in https://github.com/CakeDC/users/blob/master/Docs/Home.md. But never success with below error:

Error 400: redirect_uri_mismatch You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy.

If you're the app developer, register the redirect URI in the Google Cloud Console.

redirect_uri: http://localhost:2500/auth/google

can anybody tell me how this plugin running wel with google oAuth? Is there any examples?

thank

rochamarcelo commented 2 years ago

@wawanabnan You need to go to Google Cloud Console and add the url http://localhost:2500/auth/google as Authorized redirect URIs

https://console.cloud.google.com/apis/credentials -> Click at OAuth 2.0 Client ID -> Add Authorized redirect URI

wawanabnan commented 2 years ago

of course the "redirect_uri_mismatch" occurs even though I have added http://localhost:2500/auth/google in my credential's uri. Is there any setting needed?

rochamarcelo commented 2 years ago

@wawanabnan

I just created a new project and oauth2 credential at google console and tested with https://github.com/CakeDC/users-example . It worked for me.

Are you sure that your browser is using http and not https ?

wawanabnan commented 2 years ago

Sure I use http not https. I use local server usign laragon. But I also have tested on my hosting using https but get some error. I am testing your https://github.com/CakeDC/users-example.

Thank for your response.

wawanabnan commented 2 years ago

You are right. Both of them working well including facebook. Sorry I use d the wrong Google ClientID (typo mistake). thank a lot for your great project.

wawanabnan commented 2 years ago

case close

rochamarcelo commented 2 years ago

Happy to know that it worked.