New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

marvin-auth-kit

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marvin-auth-kit

Javscript authentication kit

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34
increased by385.71%
Maintainers
1
Weekly downloads
 
Created
Source

Marvin auth kit

This marvin-auth module provides easy implementation with the backend authention module written bij Stijn Van Looy.

Getting started

Installation

Install marvin-auth:

yarn add marvin-auth

Create instance

All authentication methods are available on the Auth class. Create an auth instance:

// import { Auth } from "marvin-ui-kit";
import { Auth } from "marvin-ui-kit";

export const auth = new Auth({
  url: "/auth",
  tenant: ‘tenantName’,
});

Have fun

Now you can have fun with authentication:

auth.login(‘username’, ‘password’);
auth.logout(‘username’, ‘password’);

Interceptors

To ensure all requests are enriched with authentication headers, add these interceptors to your application:

import axios from "axios";
import { auth } from "./services/auth.service";
import history from "./history";

// Request interceptor
axios.interceptors.request.use(async (config) => {
  return await auth.requestInterceptor(config);
});

// Response interceptor
axios.interceptors.response.use(
  function responseOK(value: any): any {
    return value;
  },
  function responseNOK(error) {
    return auth.responseErrorHandler(error, () => {
      // handle unauthenticated response
      history.push("/login");
    });
  }
);

Keywords

FAQs

Package last updated on 08 Apr 2020

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