返回介绍

Ionic4 MS ADAL 插件

发布于 2019-11-23 07:41:00 字数 1954 浏览 994 评论 0 收藏 0

Active Directory Authentication Library (ADAL) plugin. Active Directory Authentication Library ( ADAL ) plugin provides easy to use authentication functionality for your Apache Cordova apps by taking advantage of Windows Server Active Directory and Windows Azure Active Directory. Here you can find the source code for the library.

https://github.com/AzureAD/azure-activedirectory-library-for-cordova

安装 Installation

ionic cordova plugin add cordova-plugin-ms-adal npm install @ionic-native/ms-adal 
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/ms-adal 

支持的平台 Supported Platforms

  • Android
  • iOS
  • Windows

用法 Usage

import { MSAdal, AuthenticationContext, AuthenticationResult } from '@ionic-native/ms-adal/ngx';

constructor(private msAdal: MSAdal) {}

...

let authContext: AuthenticationContext = this.msAdal.createAuthenticationContext('https://login.windows.net/common');

authContext.acquireTokenAsync('https://graph.windows.net', 'a5d92493-ae5a-4a9f-bcbf-9f1d354067d3', 'http://MyDirectorySearcherApp')
  .then((authResponse: AuthenticationResult) => {
    console.log('Token is' , authResponse.accessToken);
    console.log('Token will expire on', authResponse.expiresOn);
  })
  .catch((e: any) => console.log('Authentication failed', e));

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文