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

@manifoldco/shadowcat

Package Overview
Dependencies
Maintainers
21
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@manifoldco/shadowcat

Invisible web component auth implementation of Manifold's PUMA

  • 0.1.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
21
Created
Source

shadowcat

Simple JS OAuth solutions for Manifold UI

Usage

React

In a terminal, install @manifoldco/shadowcat for your app:

npm i @manifoldco/shadowcat

Then register the web component (we recommend as high up the DOM tree as possible, so it’ll load sooner).

import React, { useEffect, useRef } from "react";

import("@manifoldco/shadowcat/dist/loader").then(({ defineCustomElements }) =>
  defineCustomElements(window)
);

const App = () => {
  const authRef = useRef(null);

  useEffect(() => {
    // Fires whenever a token is received
    const tokenReceived = detail => {
      console.log(detail);
      // {
      //   duration: 1450,
      //   error: null,
      //   expiry: 1566565841,
      //   token: "Hi I'm a super duper secret token!"
      // }
    };

    if (authRef.current) {
      authRef.addEventListener("receiveManifoldToken", tokenReceived);
    }
  }, []);

  return (
    <>
      <Routes />
      <manifold-oauth ref={authRef} /> {/* this can be placed anywhere, really, but the sooner it loads the better  */}
    </>
  );
};

HTML / JS

<body>
  <manifold-auth></manifold-auth>
  <script src="https://unpkg.com/@manifoldco/shadowcat/dist/manifold.js"></script>
  <script>
    document
      .querySelector("manifold-oauth")
      .addEventListener("receiveManifoldToken", e => {
        console.log(e.detail);
        // {
        //   duration: 1450,
        //   error: null,
        //   expiry: 1566565841,
        //   token: "Hi I'm a super duper secret token!"
        // }
      });
  </script>
</body>

CDN

In any setup, you can use a CDN for Shadowcat

https://js.cdn.manifold.co/@manifoldco/shadowcat/       # latest (beware of breaking changes!)
https://js.cdn.manifold.co/@manifoldco/shadowcat@0.2.0/ # specific version

Options

OAuth URL

You can change the OAuth URL from Manifold’s default by specifying oauth-url on the custom element:

<manifold-oauth oauth-url="[your-oauth-url]"></manifold-oauth>

Code of Conduct | Contribution Guidelines

GitHub release

Travis

version (scoped)

License

FAQs

Package last updated on 05 Sep 2019

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