
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
axios-oauth-client
Advanced tools
OAuth 2.0 client utils for axios
$ npm install --save axios-oauth-client axios-token-interceptor axios
const axios = require('axios');
const oauth = require('axios-oauth-client');
const getAuthorizationCode = oauth.client(axios.create(), {
url: 'https://oauth.com/2.0/token',
grant_type: 'authorization_code',
client_id: 'foo',
client_secret: 'bar',
redirect_uri: '...',
code: '...',
scope: 'baz',
});
const auth = await getAuthorizationCode(); // => { "access_token": "...", "expires_in": 900, ... }
const axios = require('axios');
const oauth = require('axios-oauth-client');
const getOwnerCredentials = oauth.client(axios.create(), {
url: 'https://oauth.com/2.0/token',
grant_type: 'password',
client_id: 'foo',
client_secret: 'bar',
username: 'asdf',
password: 'yuio',
scope: 'baz'
});
const auth = await getOwnerCredentials(); // => { "access_token": "...", "expires_in": 900, ... }
const axios = require('axios');
const oauth = require('axios-oauth-client');
const getClientCredentials = oauth.client(axios.create(), {
url: 'https://oauth.com/2.0/token',
grant_type: 'client_credentials',
client_id: 'foo',
client_secret: 'bar',
scope: 'baz'
});
const auth = await getClientCredentials(); // => { "access_token": "...", "expires_in": 900, ... }
const axios = require('axios');
const oauth = require('axios-oauth-client');
const getRefreshToken = oauth.client(axios.create(), {
url: 'https://oauth.com/2.0/token',
grant_type: 'refresh_token',
client_id: 'foo',
client_secret: 'bar',
refresh_token: '...',
scope: 'baz'
});
const auth = await getRefreshToken(); // => { "access_token": "...", "refresh_token": "...", "expires_in": 900, ... }
const axios = require('axios');
const oauth = require('axios-oauth-client');
const tokenProvider = require('axios-token-interceptor');
const getOwnerCredentials = oauth.client(axios.create(), {
// see example above
})
const instance = axios.create();
instance.interceptors.request.use(
// Wraps axios-token-interceptor with oauth-specific configuration,
// fetches the token using the desired claim method, and caches
// until the token expires
oauth.interceptor(tokenProvider, getOwnerCredentials)
);
MIT
FAQs
OAuth 2.0 client utils for axios
The npm package axios-oauth-client receives a total of 50,804 weekly downloads. As such, axios-oauth-client popularity was classified as popular.
We found that axios-oauth-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.