4
我試圖通過的OAuth2連接到谷歌。我使用的代碼適用於其他應用程序,所以我很確定問題出在Google的配置中。通過OAuth 2連接到谷歌「無效的參數值REDIRECT_URI:缺少權威:」
我註冊谷歌控制檯客戶端ID和祕密密鑰,我加入到授權的配置:
var client = new GoogleOAuth2Client("[client id].apps.googleusercontent.com", "[secret key]");
var extraData = new Dictionary<string, object>();
OAuthWebSecurity.RegisterClient(client, "Google", extraData);
不幸的是,當我按下按鈕,連接我得到以下錯誤:
- That’s an error.
Error: invalid_request
Invalid parameter value for redirect_uri: Missing authority:
file:///Account/ExternalLoginCallback%3FReturnUrl=/
Request Details
scope= https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/userinfo.email
response_type=code
redirect_uri=file:///Account/ExternalLoginCallback%3FReturnUrl=/
state=provider=google&sid=[numbers] client_id=[client id].apps.googleuserconte
我試圖改變/etc/hosts
文件到另一基站的URL本地主機參數和我下面增加這些位置重定向在谷歌控制檯的URI:
http://localhost:8080/Account/ExternalLoginCallback%3FReturnUrl=/
http://localhost.example.com:8080/Account/ExternalLoginCallback
http://localhost.example.com:8080/Account/ExternalLoginCallback%3FReturnUrl=/
的錯誤仍然存在。我不知道問題是什麼,我希望有人能給我一些指導。謝謝