by tigerdi | v1.0.9
A NativeScript plugin for Microsoft's Active Directory Authentication Library.
npm i --save nativescript-azure-ad

NativeScript Active Directory Authentication Library Plugin

Build Status NPM version Downloads BCH compliance

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

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.


tns plugin add nativescript-azure-ad

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 'nativescript-azure-ad';

const authority: string = '{your-tenant-id}';
const clientId: string = '{your-application-id}';
const resourceId: string = '00000002-0000-0000-c000-000000000000';
var redirectUri: string
if (application.ios) {
redirectUri = '{iOS application redirectUri}';
} else {
redirectUri = '{Android application redirectUri}';

export class AdalService {

public adalContext: AdalContext;

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

...and consume this service in your application!

export class AppComponent {

constructor(private adalService: AdalService) { }

public login() {
this.adalService.adalContext.login().then((result) => {

Known issues on iOS

Trouble running on the simulator

Open or create App_Resources/iOS/<appname>.entitlements and add these two keys with the value true:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">


See LICENSE for details.