0.8.2 • Published 30 days ago

oauth2-discord-proxy v0.8.2

Weekly downloads
-
License
MIT
Repository
github
Last release
30 days ago

oauth2-discord-proxy

GitHub Actions Workflow Status

Description

oauth2-discord-proxy is a proxy service that uses Discord OAuth 2.0 authentication powered by honojs/hono. The motivation for this project is adding Discord authentication to services that do not have authentication functionality.

Installation

bun

bun install oauth2-discord-proxy

npm

npm install oauth2-discord-proxy

Usage

First, create a new Hono instance and add a route with createProxy().

import { Hono } from 'hono'
import { createBot, createProxy } from 'oauth2-discord-proxy'
import { client_id, client_secret, discord_guild_id, discord_token, oauth2_callback, oauth2_endpoint } from './config.json'

const app = new Hono()

app.route('/', createProxy({
  bot: createBot(discord_token),
  client_id,
  client_secret,
  discord_guild_id,
  oauth2_callback,
  oauth2_endpoint,
}))

app.get('/', c => c.text('ok'))

Finally, serve a application.

import { serve } from 'bun'
import { port } from './config.json'

serve({
  fetch: app.fetch,
  port,
})

console.log(`listening at http://0.0.0.0:${port}`)
console.log(`login: http://0.0.0.0:${port}/login`)

Also, example code is here.

License

MIT

0.8.1

30 days ago

0.8.0

30 days ago

0.8.2

30 days ago

0.7.0

1 month ago

0.6.0

1 month ago

0.5.0

2 months ago

0.4.0

2 months ago

0.3.0

2 months ago

0.2.0

2 months ago

0.1.1

2 months ago

0.1.0

2 months ago