1

I'm trying to implement a google sign in system into my Angular site. I believe I have gone through the configuration process correctly, as Google's login page redirects to localhost/callback just like I told it to. Here is my controller code:

.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);
}])

Without enabling html5 mode, I don't know how to make my application respond to a request to localhost/callback, only localhost/#/callback, but in the Google Developer Console I can't put the "#" symbol into a redirect URI.

Is there some way to make angular respond to a request without /#/ without putting the application into html5 mode? Alternatively, is there some way to make localhost/#/callback a valid redirect URI in the Google Developer Console?

1 Answers1

0

You could try encoding the url so that # characters end up being #%23

  • Changing the "#" to "%23" in the allowed redirect URI prevented Google from stopping me from saving it in the Developer Console, but when I actually made the login request as a user it gave me the same error about URI fragments – Jacob Weightman Mar 17 '16 at 19:13