Socket
Socket
Sign inDemoInstall

sbx-react-auth-hoc

Package Overview
Dependencies
19
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sbx-react-auth-hoc

Authentication wrapper library for sbx


Version published
Maintainers
4
Created

Readme

Source

sbx-react-auth-hoc

Authentication wrapper library for sbx

NPM JavaScript Style Guide

Install

npm install --save sbx-react-auth-hoc
yarn add sbx-react-auth-h oc

Usage

import React, {useState} from "react";
import { initialize, Auth } from "sbx-react-auth-hoc";
import { SbxCoreService, SbxSessionService } from "sbx-axios";

const sbxCoreService = new SbxCoreService();
const sbxSessionService = new SbxSessionService(sbxCoreService);
sbxSessionService.initialize(process.env.REACT_APP_DOMAIN, process.env.REACT_APP_APP_KEY);

initialize(sbxCoreService, sbxSessionService, process.env.REACT_APP_VALIDATE_CS);

const App = () => {
  const [logged, setLogged] = useState(false);

  function handleLogin() {
    setLogged(true);
  }

  return (
    <div>
      <Auth
        onError={() => {
          console.log("not ok");
        }}
        onSuccess={res => {
          console.log(res);
          setLogged(true);
        }}
        onErrorComponent={<div>not ok</div>}
        logged={logged}
      >
        <div>ok</div>
      </Auth>

      <button onClick={handleLogin}>login</button>
    </div>
  );
};

export default App;

License

MIT © caberrio

Keywords

FAQs

Last updated on 11 Dec 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc