Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adal-node

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adal-node

Windows Azure Active Directory Client Library for node

  • 0.1.20
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
146K
decreased by-39.34%
Maintainers
2
Weekly downloads
 
Created

What is adal-node?

The adal-node package is a Node.js library that provides authentication and authorization functionalities using Azure Active Directory (AAD). It allows applications to authenticate users and acquire tokens to access Azure resources.

What are adal-node's main functionalities?

Authentication

This feature allows you to authenticate a client application using client credentials (client ID and client secret) and acquire an access token to access Azure resources.

const adal = require('adal-node');
const AuthenticationContext = adal.AuthenticationContext;
const authorityUrl = 'https://login.microsoftonline.com/common';
const resource = 'https://graph.windows.net';
const clientId = 'your-client-id';
const clientSecret = 'your-client-secret';
const context = new AuthenticationContext(authorityUrl);

context.acquireTokenWithClientCredentials(resource, clientId, clientSecret, (err, tokenResponse) => {
  if (err) {
    console.log('Error acquiring token: ', err);
  } else {
    console.log('Token acquired: ', tokenResponse);
  }
});

Token Refresh

This feature allows you to refresh an expired access token using a refresh token, ensuring continuous access to Azure resources without requiring the user to re-authenticate.

const adal = require('adal-node');
const AuthenticationContext = adal.AuthenticationContext;
const authorityUrl = 'https://login.microsoftonline.com/common';
const resource = 'https://graph.windows.net';
const clientId = 'your-client-id';
const refreshToken = 'your-refresh-token';
const context = new AuthenticationContext(authorityUrl);

context.acquireTokenWithRefreshToken(refreshToken, clientId, null, resource, (err, tokenResponse) => {
  if (err) {
    console.log('Error refreshing token: ', err);
  } else {
    console.log('Token refreshed: ', tokenResponse);
  }
});

User Authentication

This feature allows you to generate an authentication URL for user login. The user navigates to this URL to authenticate and authorize the application to access Azure resources on their behalf.

const adal = require('adal-node');
const AuthenticationContext = adal.AuthenticationContext;
const authorityUrl = 'https://login.microsoftonline.com/common';
const resource = 'https://graph.windows.net';
const clientId = 'your-client-id';
const redirectUri = 'http://localhost:3000/callback';
const context = new AuthenticationContext(authorityUrl);

const authUrl = context.getAuthCodeUrl({
  response_type: 'code',
  client_id: clientId,
  redirect_uri: redirectUri,
  resource: resource
});

console.log('Navigate to: ', authUrl);

Other packages similar to adal-node

Keywords

FAQs

Package last updated on 18 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc