Socialite Google redirect_uri_mismatch

走远了吗. 提交于 2019-12-11 03:25:54

问题


I am trying to login with google using socialite , my facebook login works fine so the problem in my google app, any help!!!

 'google' => [
    'client_id' =>      'app-key',
    'client_secret' =>  'app-secret',
    'redirect' =>       'http://www.shoptizer.com/callback/google',
],


回答1:


I found this link https://blog.damirmiladinov.com/laravel/laravel-5.2-socialite-google-login.html

From this tutorial:

Occasionally it happens that google require some time to apply client configuration If you get an error message redirect_uri_missmatch wait couple of minutes and it should work normally.

Also change the redirect uri by:

'google' => [
   'client_id' =>      'app-key',
   'client_secret' =>  'app-secret',
   'redirect' =>       'https://www.shoptizer.com/callback/google',
],

If your app is provided by https you must match your http scheme on google api and on your redirect callback.




回答2:


Also one more point to remember that Socialite also gives uri_mismatch_error even when your redirects are correctly defined in google console but you dynamically changed the redirectUrl through

return Socialite::with('google')->redirectUrl($redirect_url)->redirect();

So plz take care that you should also need to define while receiving the response

Socialite::driver('google')->redirectUrl($redirect_url)->stateless()->user();

where $redirect_url is your custom redirect url. After google redirects you to correct place, but even then Socialite checks it at its end.



来源:https://stackoverflow.com/questions/53399021/socialite-google-redirect-uri-mismatch

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