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

axios-easy-auth

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-easy-auth

Modified axios with a simple addition of headers

  • 1.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

Were there any problems adding headers to the request?

This library makes it easy.


const auth = new EasyAuth('https://jsonplaceholder.typicode.com', 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9')

First we need to create the EasyAuth class. Parameters accept site url, access token.


const postData = async () => {
    const responce = await auth.post('/posts', {}, {Header: 'value'}) 
    console.log('POST')
    console.log(responce.data)
}
// post(path: string, body: array, headers: array)

Then you can make requests to the server. EasyAuth supports GET, POST, PUT, PATCH, DELETE methods. You need axios to work. Documentation for all methods on github. Please write about errors there.

Пример: https://github.com/KirillUsenko/examples-axios-easy-auth



Были проблемы с добавлением хэдеров в запрос?

Данная библиотека упрощает это.


const auth = new EasyAuth('https://jsonplaceholder.typicode.com', 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9')

Для начала нужно создать класс EasyAuth. Параметрами принимает url сайта, access токен.


const postData = async () => {
    const responce = await auth.post('/posts', {}, {Header: 'value'}) 
// post(path: string, body: array, headers: array)
console.log('POST')
console.log(responce.data)

}

Далее можно делать запросы на сервер. EasyAuth поддерживает методы GET, POST, PUT, PATCH, DELETE. Для работы нужен axios. Документация для всех методов на github. Про ошибки пишите туда же.

Пример: https://github.com/KirillUsenko/examples-axios-easy-auth

Keywords

FAQs

Package last updated on 26 Aug 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

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