Skip to content

location hash issue running angularjs 1.6.1 and html5mode false #48

@rowdyy1960

Description

@rowdyy1960

Looks like there is an issue with angularjs 1.6.1 if you are running with $locationProvider.html5Mode(false) where it is now adding a #! to the beginning of the hash. the issue is detailed here. https://docs.angularjs.org/guide/migration#commit-aa077e8

this causes the id_token to be lost in getTokenFromHasParams. Its not difficult to fix, either set html5Mode to true, or add $locationProvider.hasPrefix('') to app.module configuration:

(function () {

var app = angular.module('MainModule',["ngRoute","afOAuth2"]);

//configure routing. Add restircted: true to require authentication

app.config(function ($routeProvider, $locationProvider) {
    $locationProvider.html5Mode(false);
    $locationProvider.hashPrefix('');

    $routeProvider
        .when('/',{
            templateUrl: 'index.html',
            controller: 'MainController'
            ,requireToken: true
        }).otherwise({
            redirectTo: "/"
        });
});

}());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions