Skip to content

byteboomers/userhut-js

Repository files navigation

userhut

Userhut JavaScript library

Installation

NPM

npm install --save userhut

npm package link

CDN

<script src="https://unpkg.com/userhut@latest"></script>

Usage

Initialize

import Userhut from "userhut";
const userhut = new Userhut("your-user-pool-id");
await userhut.initialize();

Fetch authenticated user

const authenticated = await userhut.getAuthenticated();

Fetch token

const token = await userhut.getToken();

Sign out

await userhut.signOut();

Open sign in page

userhut.openSignInPage({
  redirect: window.location.href
});

Git hooks

  • pre-commit: re-format staged files with Prettier

Scripts

# Build for production
npm run build

# Re-format files with Prettier
npm run prettier