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

@axa-fr/react-oidc-context-fetch

Package Overview
Dependencies
Maintainers
6
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axa-fr/react-oidc-context-fetch

Inject authentification behavior to fetch using react High Order Component

  • 3.1.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24
decreased by-76.47%
Maintainers
6
Weekly downloads
 
Created
Source

@axa-fr/react-oidc-context-fetch

About

This component allows by composition to improve "fetch" of new behavior. The "fetch" return to the same signature as "fetch". You do not have to use these components if they do not meet your needs. The purpose of these components is to avoid you always writing the same code and normalize the behavior (url, redirection, ect.) of your applications.

  • withFetchRedirectionOn403
    • Allow to redirects to the unauthorized route
  • withFetchSilentAuthenticateAndRetryOn401
    • Triggers authentication the update of the token if it has expired
  • withFetchToken
    • Injects the token jwt in bearer mode to make the REST call to the server
  • withAuthentication
    • Composition of the previous 3 behaviors.

Getting Started

npm install @axa-fr/react-oidc-context-fetch --save
import { compose, lifecycle } from 'recompose';
import { withAuthentication } from '@axa-fr/react-oidc-context-fetch';

const enhance = compose(
  withAuthentication,
  lifecycle({
    componentWillMount() {
      // This "fetch" manage more than the orginal fetch
      this.props
        .fetch('/yourapi')
        .then(function(response) {
          // Do Something
        })
        .then(function(body) {
          // Do Something else
        });
    }
  })
);

export default enhance(FleetDeclaration);

Keywords

FAQs

Package last updated on 17 Jun 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