@bantohq/cli-auth
v0.1.2
Published
Authentication helper for command-line tools that talk to authenticated [banto.tv](https://banto.tv) endpoints. Implements the loopback login flow and caches the resulting token per-user.
Readme
@bantohq/cli-auth
Authentication helper for command-line tools that talk to authenticated banto.tv endpoints. Implements the loopback login flow and caches the resulting token per-user.
Used internally by @bantohq/cli;
published for tooling that needs the same authenticated access.
npm install @bantohq/cli-authUsage
import { getValidToken, authedFetch } from "@bantohq/cli-auth";
// Returns a cached token, refreshing via the loopback flow if needed.
const token = await getValidToken({ /* options */ });
// Or make an authenticated request directly.
const res = await authedFetch(url, { /* options */ });Other exports: logout, runLoginFlow, and the token cache helpers
(getCachedToken, setCachedToken, clearCachedToken).
