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

elysia-oauth2

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elysia-oauth2

Elysia plugin for OAuth 2.0 Authorization Flow with more than 48 providers

  • 1.3.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
768
decreased by-1.66%
Maintainers
0
Weekly downloads
 
Created
Source

elysia-oauth2

Elysia plugin for OAuth 2.0 Authorization Flow.

Powered by Arctic with more than 48 oauth2 providers!

Installation

bun install elysia-oauth2 arctic

Update

if Arctic will release some new providers, you can update it with

bun install arctic@latest

Example

import { Elysia } from "elysia";
import { oauth2 } from "elysia-oauth2";

new Elysia()
    .use(
        oauth2({
            VK: [
                "clientID",
                "clientSecret",
                "https://example.com/auth/vk/callback",
            ],
        })
    )
    .get("/auth/vk", ({ oauth2 }) => oauth2.redirect("VK"))
    .get("/auth/vk/callback", async ({ oauth2 }) => {
        const token = await oauth2.authorize("VK");

        // send request to API with token
    })
    .listen(3001);

CreateURL example

import { Elysia } from "elysia";
import { oauth2 } from "elysia-oauth2";

new Elysia()
    .use(
        oauth2({
            Google: [
                "clientID",
                "clientSecret",
                "https://example.com/auth/Google/callback",
            ],
        })
    )
    .get("/auth/google", ({ oauth2, redirect }) => {
        const url = await oauth2.createURL("Google");
        url.searchParams.set("access_type", "offline");

        return redirect(url.href);
    })
    .get("/auth/google/callback", async ({ oauth2 }) => {
        const token = await oauth2.authorize("Google");

        // send request to API with token
    })
    .listen(3001);

Supported providers

  • 42 School
  • Amazon Cognito
  • AniList
  • Apple
  • Atlassian
  • Auth0
  • Authentik
  • Bitbucket
  • Box
  • Coinbase
  • Discord
  • Dribbble
  • Dropbox
  • Facebook
  • Figma
  • Github
  • GitLab
  • Google
  • Intuit
  • Kakao
  • Keycloak
  • Lichess
  • Line
  • Linear
  • LinkedIn
  • Microsoft Entra ID
  • MyAnimeList
  • Notion
  • Okta
  • osu!
  • Patreon
  • Reddit
  • Roblox
  • Salesforce
  • Shikimori
  • Slack
  • Spotify
  • Strava
  • Tiltify
  • Tumblr
  • Twitch
  • Twitter
  • VK
  • WorkOS
  • Yahoo
  • Yandex
  • Zoom

Keywords

FAQs

Package last updated on 17 Jul 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