Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google Oauth在AngularJS回调中没有html5模式_Angularjs_Oauth 2.0_Google Login_Developer Console - Fatal编程技术网

Google Oauth在AngularJS回调中没有html5模式

Google Oauth在AngularJS回调中没有html5模式,angularjs,oauth-2.0,google-login,developer-console,Angularjs,Oauth 2.0,Google Login,Developer Console,我正试图在我的网站上实现一个谷歌登录系统。我相信我已经正确地完成了配置过程,正如我告诉它的那样,谷歌的登录页面重定向到localhost/callback。这是我的控制器代码: .controller('LoginCtrl', ['$scope', function($scope) { var clientid = "client id from developer console"; var redirect = "http://localhost/callback";

我正试图在我的网站上实现一个谷歌登录系统。我相信我已经正确地完成了配置过程,正如我告诉它的那样,谷歌的登录页面重定向到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开发者控制台中,我无法将“#”符号放入重定向URI


有没有什么方法可以让angular在不将应用程序置于html5模式的情况下响应请求?或者,是否有某种方法使localhost/#/callback在Google开发者控制台中成为一个有效的重定向URI?

您可以尝试对url进行编码,使#字符最终成为#%23

您可以尝试对url进行编码,使#字符最终成为#%23

将“#”更改为“%23”在允许的重定向URI中,Google阻止我将其保存在开发人员控制台中,但当我作为用户实际发出登录请求时,它给了我相同的URI碎片错误。在允许的重定向URI中,将“#”改为“%23”,Google阻止我将其保存在开发人员控制台中,但是当我作为一个用户实际发出登录请求时,它给了我关于URI片段的相同错误。幸运的是,你解决了这个问题吗?面对同样的事情。运气好吗?你解决这个问题了吗?面对同样的事情。