将令牌存储到URL中的js文件中的对象中

时间:2017-03-17 06:02:42

标签: angularjs

我在从电子邮件链接存储令牌时遇到了一些问题。实际上,我正在使用angularjs。例如,我在此链接中获得了此邮件http://65.147.100.19:8090/UAR-Machine-V0.3_2/#/build/?456456的链接,我想存储令牌"?456456"当我点击链接时,我会在重定向期间重定向到登录页面我希望将此令牌存储为对象。令牌使用该令牌验证经过身份验证的用户。它与令牌验证相同,但我想这样做使用在URL中发布的动态令牌进行验证。 在此先感谢。

1 个答案:

答案 0 :(得分:0)

这里叫做我的网址(用appen我的sessionID等详细信息),如bellow,

"http://localhost:7070/dais-portal/#/SocialLandingPage/"+userID+"/"+entityId+"/"+channelID+"/"+sessionID

js file

app.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
    /*
     * $urlRouterProvider.otherwise('/');
     */
    $stateProvider

    .state('SocialLandingPage', {
        url: '/SocialLandingPage/:userID/:entityId/:channelID/:sessionID',
        views: {
            'content-page': {
                templateUrl: 'loginPage/view/dais-dummy-landing-page.html'
            }
        }
    })
    }

dummy-landing-page.html,这里称为一个控制器。并获得所有值。(如userID,entityId,channelID和sessionID)

来自该控制器。 我是这样的,

$scope.userID = $stateParams.userID;
$scope.entityId = $stateParams.entityId;
$scope.channelID = $stateParams.channelID;
$scope.sessionID = $stateParams.sessionID;