@aminebizid/nativescript-adal

A NativeScript plugin for Microsoft's Active Directory Authentication Library.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
10Aug 11, 2018Aug 8, 2018Minified + gzip package size for @aminebizid/nativescript-adal in KB

Readme

NativeScript Active Directory Authentication Library Plugin

This plugin allows you to quickly add Azure Active Directory Authentication to your NativeScript app Thanks to NavaraBV

Prerequisites / Requirements

Your application requires to be registered inside your Azure Active Directory (AAD). Visit the Azure Portal and log in with your organizational account. Grab your Azure AD Tenant ID and Application ID after registering your application.

Installation

tns plugin add @aminebizid/nativescript-adal

Usage (Angular example)

Import the AdalContext class in application in, for example, an 'AdalService' and initialize it.

import { Injectable } from '@angular/core';
import { AdalContext } from '@aminebizid/nativescript-adal';

const authority: string = 'https://login.microsoftonline.com/{your-tenant-id}';
const clientId: string = '{your-application-id}';
const resourceId: string = '00000002-0000-0000-c000-000000000000';

@Injectable()
export class AdalService {

  public adalContext: AdalContext;

  constructor() {
    this.adalContext = new AdalContext(authority, clientId, resourceId);
  }
}

...and consume this service in your application!

export class AppComponent {

  constructor(private adalService: AdalService) { }

  public login() {
    this.adalService.adalContext.login().then((result) => {
      console.log('Success!');
    })
  }

  public logout() {
    this.adalService.adalContext.logout();
  }
}

License

See LICENSE for details.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.