मैं वाईआई 2, GoogleOAuth और yii2-user एक्सटेंशन का उपयोग कर रहा हूं। मैं उपयोगकर्ता गूगल हलकों प्राप्त करते हैं और मेरी config करने के लिए गुंजाइश सेट करना चाहते हैं: जब मैं गूगल OAuth2 के साथ प्रवेशyii2, google outh2 और scope
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'yii\authclient\clients\GoogleOAuth',
'clientId' => '758709912345-p4qp4lqihit5un1u6qb75msqp5m5j6d8.apps.googleusercontent.com',
'clientSecret' => 'ZygOIi1-0asfktUQ1pKOFOo',
'scope' => 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/drive',
],
],
]
मैं था त्रुटि:
Exception – yii\authclient\InvalidResponseException Request failed with code: 400, message: { "error" : "redirect_uri_mismatch" }
गूगल प्रतिक्रिया:
[
'url' => 'https://accounts.google.com/o/oauth2/token'
'content_type' => 'application/json'
'http_code' => 400
'header_size' => 435
'request_size' => 644
'filetime' => -1
'ssl_verify_result' => 0
'redirect_count' => 0
'total_time' => 0.115431
'namelookup_time' => 0.001186
'connect_time' => 0.025188
'pretransfer_time' => 0.076275
'size_upload' => 456
'size_download' => 39
'speed_download' => 337
'speed_upload' => 3950
'download_content_length' => -1
'upload_content_length' => 456
'starttransfer_time' => 0.114206
'redirect_time' => 0
'certinfo' => []
'primary_ip' => '2a00:1450:4010:c08::54'
'primary_port' => 443
'local_ip' => '2a03:6f00:1::5c35:726b'
'local_port' => 33160
'redirect_url' => ''
]
जब मैंने कॉन्फ़िगरेशन से हटा दिया Google+ स्कोप (https://www.googleapis.com/auth/plus.login) प्रमाणीकरण wi केवल https में
[
'url' => 'https://accounts.google.com/o/oauth2/token'
'content_type' => 'application/json; charset=utf-8'
'http_code' => 200
'header_size' => 522
'request_size' => 526
'filetime' => -1
'ssl_verify_result' => 0
'redirect_count' => 0
'total_time' => 0.13719
'namelookup_time' => 0.001212
'connect_time' => 0.026261
'pretransfer_time' => 0.079765
'size_upload' => 338
'size_download' => 900
'speed_download' => 6560
'speed_upload' => 2463
'download_content_length' => -1
'upload_content_length' => 338
'starttransfer_time' => 0.136241
'redirect_time' => 0
'certinfo' => []
'primary_ip' => '2a00:1450:4010:c08::54'
'primary_port' => 443
'local_ip' => '2a03:6f00:1::5c35:726b'
'local_port' => 37583
'redirect_url' => ''
]
समस्या:: त्रुटि बाहर th और गूगल प्रतिक्रिया है //www.googleapis.com/auth/plus.login। मेरी सक्षम एपीआई: http://minus.com/lJ5nw7caXJApD
सिर्फ एक यह नहीं कि 'https: // www.googleapis.com/auth/userinfo.email' को बहिष्कृत किया गया है। आपको इसके बजाय 'ईमेल' का उपयोग करना चाहिए। [डॉक्स] देखें (https://developers.google.com/+/api/oauth) – Tahir
यदि मैं केवल https://www.googleapis.com/auth/plus.login को दायरे में डालता हूं तो मुझे एक ही त्रुटि है "redirect_uri_mismatch "। – 1Pauletto
आप जानते हैं कि यह त्रुटि 'रेडियरेक्ट यूआरआईएस' से संबंधित है जिसे आपको Google कंसोल में अपने ऐप क्रेडेंशियल में सेट करने की आवश्यकता है, है ना? यह आपके 'auth' कार्रवाई के लिए यूआरएल होना चाहिए। – Tahir