Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@scienta/axios-oauth2
Advanced tools
Readme
This library makes oauth with axios easy. There is a oauth-client, a token interceptor and caching.
You can use only the client, or combine it with the token interceptor and caching.
import axios from 'axios';
import {clientFactory} from '@scienta/axios-oauth';
const client = clientFactory(axios.create(), {
url: 'https://oauth.com/2.0/token',
grant_type: 'client_credentials',
client_id: 'foo',
client_secret: 'bar',
scope: 'baz'
});
const auth = await client(); // => { "access_token": "...", "expires_in": 900, ... }
import axios from 'axios';
import {clientFactory, interceptorFactory} from '@scienta/axios-oauth';
const axiosInstance = axios.create();
axiosInstance.interceptors.request.use(
interceptorFactory(clientFactory(axiosInstance, {
url: 'https://oauth.com/2.0/token',
grant_type: 'client_credentials',
client_id: 'foo',
client_secret: 'bar',
scope: 'baz'
}))
);
axiosInstance.get('https://oauth.com/2.0/protectedResource')
import axios from 'axios';
import {clientFactory, interceptorFactory, LockingTokenCache} from '@scienta/axios-oauth';
const axiosInstance = axios.create();
axiosInstance.interceptors.request.use(
interceptorFactory(
clientFactory(axiosInstance, {
url: 'https://oauth.com/2.0/token',
grant_type: 'client_credentials',
client_id: 'foo',
client_secret: 'bar',
scope: 'baz'
}),
new LockingTokenCache()
)
);
axiosInstance.get('https://oauth.com/2.0/protectedResource')
The LockingTokenCache
class uses a separate library for locking and caching.
Locking cache is a caching-library suited for simple and complex locking while caching.
Locking with caching ensures that only one request is executed to request a token.
Want to know more? @scienta/locking-cache.
FAQs
Cacheable token interceptor for oauth requests with axios
The npm package @scienta/axios-oauth2 receives a total of 260 weekly downloads. As such, @scienta/axios-oauth2 popularity was classified as not popular.
We found that @scienta/axios-oauth2 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.