Closed zlakomanoff closed 5 years ago
looks like auth urls is stuck (https://developers.google.com/identity/protocols/OAuth2WebServer) and need update OAuth2.php defaultReturnUrl method just add
unset($params['authuser']);
unset($params['session_state']);
unset($params['prompt']);
to unset block
easy money :)
Isn't this error saying that you have a different redirect uri in the Google Developer Account than you are using locally to callback? The redirect uri you set in the Google account has to match the one used in this plugin e.g. for google: http://yourhost.name/site/auth?authclient=google site/auth should match what you used for the auth handler (in this example SiteController::auth())
Thanks for posting in our issue tracker. In order to properly assist you, we need additional information:
Thanks!
This is an automated comment, triggered by adding the label status:need more info
.
Shouldn't need to use the https://www.googleapis.com/auth/plus.login
scope unless you're wanting to use it for access of social features.
https://www.googleapis.com/auth/plus.me
scope is not recommended as a login scope because, for users who have not upgraded to Google+, it does not return the user's name or email address.
Please advise. I'm running into this on my live site at https://MeetingPlanner.io :( and my localhost test site. I didn't realize it broke when I updated to OAuth2. Facebook login works but not google.
My site urls match with google in the console.
Try it here https://meetingplanner.io/site/signup
Exception – yii\authclient\InvalidResponseException Request failed with code: 400, message: { "error": "redirect_uri_mismatch", "error_description": "Bad Request" }
The same as @newscloud, in all my past projects, I've noticed it yesterday.
New version was just tagged. Please update.
This fixed it for me. Thanks @samdark
"require": { "yiisoft/yii2": "*", "yiisoft/yii2-authclient": "~2.1.7",
Request failed with code: 400, message: { "error": "redirect_uri_mismatch", "error_description": "Bad Request" }
Та же проблема появилась сегодня на всех проектах
This is not an error with the plugin but says that the registered redirect uri doesn't match what you are passing.
Do you think this is broken or have you changed your redirect uri and caused this error?
Это не ошибка с плагином, но говорит, что зарегистрированный URI перенаправления не соответствует тому, что вы передаете.
Вы думаете, что это не работает или вы изменили URI перенаправления и вызвали эту ошибку?
URI правильный, пробовал пересоздать проект думал проблема в лимитах, но нет. Также сделал все обновления которые описаны выше. Проблема только в Google, все остальные работают отлично. У товарища который писал выше комментарий также не проходит авторизация https://meetingplanner.io/site/signup
When did it stop working? Did you update the yii2-authclient plugin and then it failed? Is this a brand-new application with the latest plugin version? Did you modify the redirect uri at Google?
Когда это перестало работать? Вы обновили плагин yii2-authclient, а затем произошел сбой? Это совершенно новое приложение с последней версией плагина? Вы изменили URI перенаправления в Google?
перестало работать сегодня, без обновления, URI не менял
после появления проблемы сменил yiisoft/yii2-authclient (2.1.7 => 2.1.8) также обновил yiisoft/yii2 (2.0.20 => 2.0.21) не помогло
Maybe check that the redirect uri is still set in the Google console. Maybe they have "fixed" something and the comparison is more strict than before. Maybe they have broken something but it will take some time to find out. I do not use Google auth on Yii so I can't check whether my system is working.
Может быть, проверьте, что URI перенаправления все еще установлен в консоли Google. Может быть, они что-то «исправили» и сравнение более строгое, чем раньше. Может быть, они что-то сломали, но это займет некоторое время, чтобы узнать. Я не использую аутентификацию Google на Yii, поэтому не могу проверить, работает ли моя система.
Do you maybe use some proxy from https to http? I had similar problem using docker + traefik. I fixed it by setting base url as absolute url with https.
I have had the same problem. I didn`t change and update code, but I got this error in all of my project yesterday
unset($params['authuser']); unset($params['session_state']); unset($params['prompt']);
or set defaultUrl
in config
Have the same problem, discovered yesturday. Update core and all packages, didn't help.
Does someone has a solution?
unset($params['authuser']);
unset($params['session_state']);
unset($params['prompt']);
looks like my fix still actual today :)
unset($params['authuser']); unset($params['session_state']); unset($params['prompt']);
looks like my fix still actual today :)
it doesn't help either
I also had to add unset($params['hd']) in addition to unsetting session_state, prompt and authuser.
Also, remember the format of the response ( $client->getUserAttributes() ) changed. Previous, to get the email address, you had $client->getUserAttributes()['emails'][0]['value'] but now it's simply $client->getUserAttributes()['email']. You can var_dump($client->getUserAttributes()) to see everything.
unset($params['authuser']);
unset($params['session_state']);
unset($params['prompt']);
unset($params['hd'])
This helped, thank ou guys.
Та же байда с гуглом - переходит на гугл, все подтверждаю и потом Exception – yii\authclient\InvalidResponseException Request failed with code: 400, message: { "error": "redirect_uri_mismatch", "error_description": "Bad Request" } in H:\OSPanel\domains\tselector.com\vendor\yiisoft\yii2-authclient\src\BaseOAuth.php at line 221 С Вконтакте тоже печаль - страница долго грузится а потом 404
@Pilot1604 попробуйте master.
@samdark Спасибо! Google заработал, а с вконтакте проблема осталась - никуда не переходит а просто страница долго грузится и потом 404, но может быть что этот домен локальный и работает через NoIp - чуть позже проверю на хостинге.
looks like auth urls is stuck (https://developers.google.com/identity/protocols/OAuth2WebServer) and need update OAuth2.php defaultReturnUrl method just add
unset($params['authuser']); unset($params['session_state']); unset($params['prompt']);
to unset block
easy money :)
works for me thank you a lot
'google' => [
'class' => 'yii\authclient\clients\Google',
'clientId' => '----------------',
'clientSecret' => '--------------',
'returnUrl' => 'https://yourdomain.com/site/auth?authclient=google', // add this row
],
What steps will reproduce the problem?
config: 'scope' => 'profile email https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/plus.login'
What's expected?
authorization success
What do you get instead?
Request failed with code: 400, message: { "error": "redirect_uri_mismatch", "error_description": "Bad Request" }
Additional info