【发布时间】:2015-11-22 05:37:02
【问题描述】:
当我拨打这个电话时,它会打开帐户选择器,然后我可以选择我的一个谷歌帐户,当我这样做时,我会收到错误
Error: invalid_request
Missing required parameter: scope
我可以在帐户选择器的 URL 中看到范围变量,但是当我选择帐户时,它会丢失 URL 中的范围变量。在此示例中,我更改了我的客户 ID。 提前致谢。
app.controller("FirstController", function($scope, $location) {
$scope.redirectToGoogle = function () {
console.log("redirectToGoogle");
var client_id="myclientID";
var scope="profile email";
var redirect_uri="http://localhost:8080/auth/google/callback/";
var response_type="token";
var url="https://accounts.google.com/o/oauth2/auth?&client_id="+client_id+"scope="+scope+"&redirect_uri="+redirect_uri+"&response_type="+response_type;
window.location.replace(url);
}
});
【问题讨论】:
-
我把这个改成了$location.url(url)和$location.path(url),
-
我把它改成了 $location.url(url) 和 $location.path(url) $$path: "/accounts.google.com/o/oauth2/…" $$url: "/accounts.google.com/o/oauth2/…"
标签: javascript angularjs oauth-2.0