【问题标题】:Cordova/Ionic Framework work with ADALCordova/Ionic 框架与 ADAL 一起使用
【发布时间】:2016-05-17 15:18:01
【问题描述】:

我是移动开发的新手,正在努力使用 Azure 进行身份验证。我正在使用 Mac 进行开发工作。我创建了基于 sidemenu 模板的 Ionic 项目,向其中添加了插件“cordova-plugin-ms-adal”。为了确保代码正常工作,我在 doLogin 方法中添加了以下几行代码。我收到错误 - “VM370:1 Uncaught ReferenceError: Microsoft is not defined(...)

非常感谢您的帮助。

  $scope.doLogin = function() {
    console.log('Doing login', $scope.loginData);


    var AuthenticationContext = new Microsoft.ADAL.AuthenticationContext("https://login.microsoftonline.com/abcinc.onmicrosoft.com");
  };

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>
    <script src="js/controllers.js"></script>
  </head>

  <body ng-app="starter">
    <ion-nav-view></ion-nav-view>
  </body>
</html>

【问题讨论】:

    标签: azure ionic-framework cordova-plugins adal adal.js


    【解决方案1】:

    我还不能发表评论 - 因此在回答中

    我从头开始创建了一个 Ionic Tab 示例应用

    添加了cordova-plugin-ms-adal

    向其中一个视图添加了导航按钮

    <ion-nav-buttons side="primary">
        <button class="button" ng-click="doLogin()">
            LOGIN
        </button>
    </ion-nav-buttons>
    

    视图控制器新增doLogin方法

    .controller('DashCtrl', function ($scope) {
        $scope.doLogin = function () {
            console.log('Doing login');
            var AuthenticationContext = new Microsoft.ADAL.AuthenticationContext("https://login.microsoftonline.com/abcinc.onmicrosoft.com");
        };
    })
    

    你也一样吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-23
      • 2017-11-12
      • 2015-04-28
      • 1970-01-01
      • 1970-01-01
      • 2015-04-08
      • 2016-06-22
      • 1970-01-01
      相关资源
      最近更新 更多