superauth-js
v0.1.10
Published
A tiny auth helper for Supabase + JWT, using jose.
Downloads
162
Readme
superauth-js
A tiny auth helper for Supabase + JWT, using jose.
Installation
npm install superauth-jsUsage
import { createSuperAuth } from 'superauth-js';
const superAuth = createSuperAuth({
superAuthUrl: 'https://auth.yourdomain.com',
superAuthPublicKey: 'YOUR_BASE64_ENCODED_PUBLIC_KEY',
supabaseClient: supabase,
});
// Get URLs for auth pages
const signInUrl = superAuth.getSignInUrl(window.location.href);
const createAccountUrl = superAuth.getCreateAccountUrl(window.location.href);
const forgotPasswordUrl = superAuth.getForgotPasswordUrl(window.location.href);
const updatePasswordUrl = superAuth.getUpdatePasswordUrl(window.location.href);
const verifyEmailUrl = superAuth.getVerifyEmailUrl(window.location.href);
// Sign out
await superAuth.signOut();
// Handle token from URL (auto-called on creation in browser)
await superAuth.handleTokenFromUrl();Development
Build
npm run buildWatch mode
npm run watchCreate local package for testing
npm run pack:localThis creates a .tgz file you can install in other projects:
# In your other project
npm install /path/to/superauth-js/superauth-js-0.1.x.tgzPublishing to NPM
First-time setup
- Create an NPM account at https://www.npmjs.com/signup
- Login from the command line:
npm login
Publishing a new version
Update the version in
package.json:# Patch version (0.1.8 -> 0.1.9) npm version patch # Minor version (0.1.8 -> 0.2.0) npm version minor # Major version (0.1.8 -> 1.0.0) npm version majorPublish to NPM:
npm publishThe
prepublishOnlyscript will automatically runnpm run buildbefore publishing.Update consuming projects:
# In your other project (e.g., simmer.io) npm update superauth-js # or for a specific version npm install [email protected]
Quick publish (one-liner)
npm version patch && npm publish