npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vatom/identity-sdk

v0.0.16

Published

This library allows you to embed and use the Vatom™ Identity system to authenticate your users within your web app.

Downloads

122

Readme

Vatom™ Identity SDK

This library allows you to embed and use the Vatom™ Identity system to authenticate your users within your web app.

Installation

You can install this library by running npm install @vatom/identity-sdk or yarn add @vatom/identity-sdk

Basic Usage

In order to seamlessly integrate with your own identity system you would need to first obtain an authority and clientId. For more information about this please contact us at [email protected].

Full parameter list

VatomIdentitySDK | Parameter | Description | Default Value | | --------- | -------------------------------------------------------------------------------------------- | :-----------: | | clientId | Required. Client ID used to identify your app. | "" | | sdkConfig | Optional. SDK Configs | { loginCallbackUri: '/callback', logoutCallbackUri: '/logout-callback', authority: 'https://id.vatom.com', businessId: '' } |

VatomIdentitySDK Methods

| Name | Description | Response | | -------------- | --------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------: | | getAccessToken | Retrieve your access token | {"access_token":"xxx","expires_in":3600,"id_token":"xxx","refresh_token":"xxx","scope":"xxx","token_type":"xxx"} | | login | Triggers the login process | | | logout | Triggers the logout process | | | onCallbacks | Grants the tokens or remove the tokens. This method should be inside the callbacks components | returns "true" if function was triggered in the callbacks otherwise "false" |

Example Code using React

import './App.css';
import { useEffect } from 'react';
import { VatomIdentitySDK } from "@vatom/identity-sdk"

function App() {
  const clientId = "identity-sdk-test"
  const sdkConfig = {}
  const identitySdk = new VatomIdentitySDK(clientId, sdkConfig)
  const [accessToken, setAccessToken] = useState(identitySdk.getAccessToken())

  useEffect(() => {
    const triggerCallback = async () => {
      // Put this inside your callback components
      const res = await identitySdk.onCallbacks()
      if (res) {
        setAccessToken(identitySdk.getAccessToken())
      }
    }
    triggerCallback()
  }, [])

  return (
    <div className="App">
      {!accessToken ? (
        <button onClick={identitySdk.login}>Login</button>
      ) : (
        <span>Logged In: </span>
      )}
      {accessToken && <button onClick={identitySdk.logout}>Logout</button>}
    </div>
  )
}

export default App;