nanoauth
September 2, 2021 ยท View on GitHub
๐จ THIS IS PRE-RELEASE SOFTWARE, DO NOT USE IN PRODUCTION YET ๐จ
Like Omniauth for your SPA.
A collection of lightweight OAuth2 utilities and clients, designed to handle the redirect flow and other client-side nonsense for you, within the context of a single-page application.
Usage
-
Install with
npm install @nanoauth/base -
Set up a redirect page, to catch the responses from the server and pass them back to your SPA. This should be an HTML file with the following script, served from the same origin as your SPA:
import { handleRedirect } from '@nanoauth/base'; handleRedirect(); -
Set up one of the site-specific clients, or use the generic
getAuthorizationfunction. Boom, you get the result of the redirect.
General Utilities
@nanoauth/base
Provides a basic, low-level set of utilities for building OAuth2 integrations, as well as the redirect handler for all the site-specific clients.
Site-Specific Clients
@nanoauth/myanimelist
An OAuth2 client for MyAnimeList. Handles PKCE for you, you just have to exchange the returned code+nonce for the actual token on your server.