Home stateParams is empty in firefox
Reply: 0

stateParams is empty in firefox

richbai90
1#
richbai90 Published in 2017-12-07 23:18:43Z

My angular app has a workflow for SAML authentication. When you go to the app if you are not authenticated you go to the login controller that looks something like this:

function loginCtrl($scope, $stateParams, $state) {
    if(!angular.isDefined($stateParams.saml) {
        $scope.ssoEnabled ? $state.go('login_manual') : $state.go('login_sso');
    } else {
        var credentials = JSON.parse(btoa($stateParams.saml)); 
        // Handle authentication from the credentials that saml returned
    }
}

function ssoCtrl($window) {
    if($scope.ssoType === 'saml') {
        $window.location.href = 'https://my_saml_landing_page.php?return_to=' + encodeUriComponent('https://my_app/#/login');
    }
}

The landing page

<?php
// ... do all the stuff to authenticate the user, return the expected response in an object
$cred = base64_encode(json_encode($cred));
// append the credentials to the return url
$url['fragment'] .= "?saml=$cred";
header('Location: ' . http_build_url($url), true, 303);
die();

This works perfectly on chrome, but when I debug on firefox it says that $stateParams.saml is undefined, leading to an infinite loop.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301544 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO