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

@ackee/antonio-auth

Package Overview
Dependencies
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ackee/antonio-auth

It includes a request interceptor for `@ackee/antonio-core` that sets the `Authorization` header with an access token obtained from `getAccessToken` from `@ackee/petrus`.

  • 4.0.0-beta.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36
decreased by-10%
Maintainers
4
Weekly downloads
 
Created
Source

@ackee/antonio-auth

It includes a request interceptor for @ackee/antonio-core that sets the Authorization header with an access token obtained from getAccessToken from @ackee/petrus.

Install

yarn add @ackee/antonio-auth -S

# Check you have installed at least these dependencies' versions:
yarn add @ackee/petrus@5.2.1

API

requestAuthHeaderInterceptor(request: Request): Request

A request interceptor that sets the Authorization header with setAuthHeader from @ackee/antonio-utils and obtained from getAccessToken from @ackee/petrus.

Default usage example
import { create } from '@ackee/antonio-core';
import { requestAuthHeaderInterceptor } from '@ackee/antonio-auth';

const api = create({
    baseURL: '...',
});

api.interceptors.request.use(requestAuthHeaderInterceptor);
Custom usage example (without @ackee/petrus)
import { create } from '@ackee/antonio-core';
import { setAuthHeader } from '@ackee/antonio-utils';

const api = create({
    baseURL: '...',
});

function* getAccessToken() {
    // Your custom function for obtaining the access token.
}

api.interceptors.request.use(function* (request) {
    const accessToken = yield getAccessToken();

    setAuthHeader(requst.headers, accessToken);

    return request;
});

Keywords

FAQs

Package last updated on 07 May 2021

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