I have a SPA using AngularJS. I just added security / authentication and everything works fine except for redirection after login if exists in the query string returnUrl.
I have code in my application that will be redirected to my login if there is no user authentication. For example, if a user tries to access http://localhost:55841/#/group/15(for which authentication is required), he is redirected to the login route with the following URL:
http://localhost:55841/#/login?returnUrl=%2Fgroup%2F15
Here is my login method, which should be redirected to the returnUrl route, if it exists upon successful login:
var login = function (credentials) {
return $http.post(baseUrl + 'api/login', credentials).then(function (response) {
var returnUrl = $location.search().returnUrl;
if (returnUrl) {
$location.path(returnUrl);
}
$location.path('/');
});
};
, returnUrl /group/15, , URL-:
http://localhost:55841/#/?returnUrl=%2Fgroup%2F15