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

@azure/msal-common

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/msal-common

Microsoft Authentication Library for js

  • 1.5.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is @azure/msal-common?

The @azure/msal-common package is a Microsoft library that provides the core functionality for the authentication protocols OAuth 2.0 and OpenID Connect. It is primarily used in the development of applications that require secure access to Microsoft Azure services. The package serves as a common foundation for other Microsoft authentication libraries, enabling developers to implement authentication features efficiently.

What are @azure/msal-common's main functionalities?

Token Acquisition

This feature allows developers to acquire tokens for accessing secured resources. The code sample demonstrates how to acquire a token using a username and password.

const msal = require('@azure/msal-common');
const pca = new msal.PublicClientApplication({ auth: { clientId: 'your-client-id' } });
pca.acquireTokenByUsernamePassword({
  scopes: ['user.read'],
  username: 'user@example.com',
  password: 'your-password'
}).then(response => console.log(response)).catch(error => console.error(error));

Token Caching

Token caching is crucial for efficient authentication management, reducing the need to request new tokens for each operation. The code sample shows how to read token cache from storage.

const { TokenCache } = require('@azure/msal-common');
const cache = new TokenCache();
cache.readFromStorage('your-storage-key').then(() => {
  const accountInfo = cache.getAccount('user@example.com');
  console.log(accountInfo);
});

Account Management

This feature facilitates the management of user accounts in an application. The code sample retrieves account information based on the username.

const msal = require('@azure/msal-common');
const pca = new msal.PublicClientApplication({ auth: { clientId: 'your-client-id' } });
pca.getAccountByUsername('user@example.com').then(account => {
  console.log(account);
}).catch(error => console.error(error));

Other packages similar to @azure/msal-common

Keywords

FAQs

Package last updated on 02 Oct 2020

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