我正在尝试在我的 Angular 网站中实现一个谷歌登录系统。我相信我已经正确完成了配置过程,因为 Google 的登录页面会重定向到 localhost/callback,就像我告诉它的那样。这是我的控制器代码:
.controller('LoginCtrl', ['$scope', function($scope) {
var clientid = "client id from developer console";
var redirect = "http://localhost/callback";
var scope = "profile%20email";
var prompt = "select_account";
var req = window.open('https://accounts.google.com/o/oauth2/v2/auth?client_id='+
clientid+'&response_type=code&redirect_uri='+redirect+'&scope='+scope+
'&prompt='+prompt);
}])
如果不启用 html5 模式,我不知道如何让我的应用程序响应对 localhost/callback 的请求,只有 localhost/#/callback,但是在 Google Developer Console 中我无法将“#”符号放入重定向URI。
是否有某种方法可以在不将应用程序置于 html5 模式的情况下使角度响应没有 /#/ 的请求?或者,是否有某种方法可以使 localhost/#/callback 在 Google Developer Console 中成为有效的重定向 URI?