Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gtramontina.com/elysia-authkit

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gtramontina.com/elysia-authkit

Elysia plugin to integrate with [AuthKit](https://www.authkit.com/).

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Elysia AuthKit

Elysia plugin to integrate with AuthKit.

[!NOTE]
This package is not affiliated with AuthKit or WorkOS. It currently only implements the flow described in the AuthKit Getting Started guide (hosted sign up and sign in forms).

Installation

bun add --exact @gtramontina.com/elysia-authkit

Usage

Follow the initial steps of the AuthKit documentation to get an account and keys setup.

import { authKit } from "@gtramontina.com/elysia-authkit";
import { WorkOS } from "@workos-inc/node";
import { Elysia } from "elysia";

new Elysia()
	.use(
		authKit({
			workos: new WorkOS(process.env.WORKOS_API_KEY),
			clientId: process.env.WORKOS_CLIENT_ID,
			jwtSecret: process.env.JWT_SECRET_KEY,
			redirectUri: "http://localhost:8080/callback",
		}),
	)
	.onError(({ code, error, set }) => {
		if (code === "UnauthorizedError") {
			set.redirect = "/login";
		}
	})
	.get("/", ({ user }) => {
		return `Hello, ${user.firstName ?? "world"}!`;
	})
	.listen(8080, () => {
		console.info("Listening on http://localhost:8080");
	});

Please feel free to explore the example for a more complete usage and the Options type for more details and options on how to customize the plugin for your needs.

FAQs

Package last updated on 26 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc