Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@azure/msal-common
Advanced tools
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.
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));
This package is a collection of Passport Strategies to help you integrate with Azure Active Directory. It is similar to @azure/msal-common but is specifically tailored for Node.js applications using Passport.js, making it more suitable for applications that already use Passport.js for other authentication needs.
oidc-client is a client-side library to help with OpenID Connect (OIDC) and OAuth2 protocol flows in web, desktop, and mobile applications. Unlike @azure/msal-common, which is optimized for Azure services, oidc-client is more generic and can be used with any OIDC-compliant identity provider.
Getting Started | AAD Docs | Library Reference |
---|
The MSAL library for JavaScript enables client-side JavaScript applications to authenticate users using Azure AD work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through Azure AD B2C service. It also enables your app to get tokens to access Microsoft Cloud services such as Microsoft Graph.
The @azure/msal-common
package described by the code in this folder serves as a common package dependency for the @azure/msal-browser
package (and in the future, the msal-node package). Be aware that this is an internal library, and is subject to frequent change. It is not meant for production consumption by itself.
See here.
This library is not meant for production use. Please use one of these packages specific to the platform you are developing for:
npm install @azure/msal-common
If you find a security issue with our libraries or services please report it to secure@microsoft.com with as much detail as possible. Your submission may be eligible for a bounty through the Microsoft Bounty program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting this page and subscribing to Security Advisory Alerts.
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License (the "License");
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
FAQs
Microsoft Authentication Library for js
The npm package @azure/msal-common receives a total of 4,788,298 weekly downloads. As such, @azure/msal-common popularity was classified as popular.
We found that @azure/msal-common demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.