Javascript AngularJS调用Google OAuth2
当我打这个电话时,它会打开帐户选择器,然后我可以选择我的一个谷歌帐户,当我这样做时,我会得到错误Javascript AngularJS调用Google OAuth2,javascript,angularjs,oauth-2.0,Javascript,Angularjs,Oauth 2.0,当我打这个电话时,它会打开帐户选择器,然后我可以选择我的一个谷歌帐户,当我这样做时,我会得到错误 Error: invalid_request Missing required parameter: scope 我可以在帐户选择器的URL中看到范围变量,但当我选择帐户时,它会丢失URL中的范围变量。在本例中,我更改了我的客户端ID。 提前谢谢 app.controller("FirstController", function($scope, $location) { $scope.red
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);
}
})) 使用AngularJS$定位服务的方法是:
var location = $location.url(url);
有关详细信息,请参见我尝试了此操作,也尝试了$location.path,我正在将对象返回到变量位置,但现在没有显示任何内容。我将此更改为$location.url(url)和$location.path(url),我将此更改为$location.url(url)和$location.path(url)$$path:“$$url:/”