New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-axios-http-jwt

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-axios-http-jwt

React hook for axios-http-jwt

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
2
-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

react-axios-http-jwt

Provides a react hook which uses axios-http-jwt to manage JWT authentication.

import axios from 'axios';
import { useClient } from 'react-axios-http-jwt';

const _client = const _client = axios.create({ withCredentials: true });

const onLogin = async (data: any): Promise<string> => {
  const response = await _client.post('/api/token/', data);
  return response.data.access;
};

const onLogout = async (): Promise<void> => {
  await _client.delete('/api/token/clear/');
};

const onRefresh = async (): Promise<string> => {
  const response = await _client.post(`/api/token/refresh/`);
  return response.data.access;
};

const client = useClient(config, onLogin, onLogout, onRefresh);

client.isAuthenticated // true when access token exists
client.isLoading // true when client attempting to load initial access token
client.axios // axios instance with access token header
client.login // login function
client.logout // logout function

Keywords

axios

FAQs

Package last updated on 20 Mar 2022

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