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

@zingle/authz-sdk

v0.0.2

Published

authz client SDK

Downloads

3

Readme

The authz-sdk package provides a browser module that can be used to interact with the authz daemon. It facilitates building integrations with the Zingle authentication service.

AuthZ SDK

The AuthZ SDK should be served from the same host as the authz authentication service. The SDK auto-detects the authentication server based where it is being served.

Functions

oauth

oauth(provider:string, flow:string)

The oauth function begins the process of authenticating through an OAuth provider. The provider name must match an OAuth provider name handled by the authz daemon. The flow mode must be "popup".

Calling oauth redirects the browser to the OAuth provider site. Upon successful authentication, a JWT token will be generated. How this token is handled depends on the flow mode.

import {oauth} from "https://authz.example.com/sdk/latest/authz-sdk.js";
oauth("google", "popup");

Flow: popup

In "popup" flow mode, the oauth function must be called from a popup window that is hosted on the same origin as the window which opens the popup. The popup window uses Window.postMessage to deliver the JWT to the window that opened the popup. The popupForJWT function can be used to implement this flow for the window that opens the popup.

popupForJWT

popupForJWT(popupURL:string|URL, callback:function)

The popupForJWT function begins the "popup" flow for authenticating with the authz daemon. This will open the popupURL page in a new window. This page is expected to negotiate a JWT token, then deliver it back to the window that opens the popup using the Window.postMessage function on the opener window. When the JWT has been posted back to the opener window, the popup will be closed and the JWT will be passed to the callback. The oauth function can be used to implement this flow in the popup window.

import {popupForJWT} from "https://authz.example.com/sdk/latest/authz-sdk.js";
// in this example, the login.html page should call the oauth function
popupForJWT("login.html", jwt => console.log(jwt));

returnJWT

Returns a JWT to the client. How this is accomplished depends on the flow mode requested by the client.

Flow: popup

In "popup" flow mode, the returnJWT function will use Window.postMessage on the window which opened the popup to deliver the JWT.