built with Hono.js & SvelteKit
Free IDaas And Single Sign-On Service
- 设计文档 Design (In Chinese): https://blog.csdn.net/jslygwx/article/details/133765190
- 开发文档 Dev Guides: TBD
- 部署文档 Deployment Guides: TBD
/auth/authorize
GET/auth/token
POST/auth/userinfo
GET/auth/revoke
POST/$lang/login
(以下需要登录 below need login)/$lang/dashboard
/api/apps
GET/POST/api/apps/:id
GET/PUT/api/apps/:id/secret
POST/DELETE/api/users
GET/api/users/:id
GET/PUT/POST/api/users/:id/forbidden
PUT/POST/api/users/:id/:provider
DELETE
Package | Meta | Changelog |
---|---|---|
@hono-dev/auth-github | Changelog | |
@hono-dev/auth-alipay | Changelog | |
@hono-dev/auth-afdian | Changelog | |
@hono-dev/powered-by | Changelog |
Important
如果需要定制化的开发,比如删除/新增登录方式,则需要具备专业的开发知识,或者联系我进行付费定制。
- 需要有 Cloudflare 账号、可配置域名和 Github 账号三项前置准备
- 在 Cloudflare 中创建好 D1 数据库和 KV 缓存桶。
- Fork 本项目,在 Settings 中做后续环境变量配置
- 设置环境变量,参考
本地开发
。注意:- 创建 Github OAuth 应用
- 创建 支付宝基础应用
- 爱发电应用需要私信 @afdian
- 如果使用 Github 的 Secrets,则不能用
GITHUB_
前缀,所以我改成了GH_
前缀,但代码中没有更改,只在 Workflow 中映射 - 注意:只有 Github 可以不填 CALLBACK_URL(其他登录方式均需要指定域名回调)
- 配置开发环境,推荐使用
bun
进行开发 - 创建
apps/website/.dev.vars
将AFDIAN_CLIENT_ID
、AFDIAN_CLIENT_SECRET
等环境变量进行配置。 - 安装依赖
bun install && bun run build
AFDIAN_CLIENT_ID=
AFDIAN_CLIENT_SECRET=
AFDIAN_CALLBACK_URL=
GITHUB_ID=
GITHUB_SECRET=
GITHUB__CALLBACK_URL=optional
ALIPAY_APP_ID=
ALIPAY_CALLBACK_URL=
ALIPAY_PRIVATE_KEY=
SESSION_KEY=optional
SESSION_SECRET=
- 在
apps/website
目录下初始化数据库:npx wrangler d1 migrations apply sso --local
- 启动
bun run build && bun run dev
- 手动修改
apps/website/.wrangler/state/v3/d1/miniflare-D1DatabaseObject
下的数据库,通过 SQLite 软件,将你的第一个用户类型type
改为admin
Important
If you need customized development, such as deleting/adding login methods, you need to have professional development knowledge, or contact me for paid customization.
- You need to have a Cloudflare account, a configurable domain, and a Github account as prerequisites.
- Create a D1 database and KV bucket in Cloudflare.
- Create KV bucket
- Create D1 database
- Create API Token
- Fork this project and do subsequent environment variable configuration in Settings.
- Set environment variables, refer to
Local Development
. Note:- Create Github OAuth App
- Create Alipay Basic App
- For Afdian application, you need to send a private message to @afdian
- If you use Github's Secrets, you can't use the
GITHUB_
prefix, so I changed it to theGH_
prefix, but the code has not been changed, only mapped in the Workflow - Note: Only Github can leave CALLBACK_URL blank (other login methods need to specify the domain callback)
- Configure the development environment, it is recommended to use
bun
for development. - Create
apps/website/.dev.vars
and configure environment variables such asAFDIAN_CLIENT_ID
,AFDIAN_CLIENT_SECRET
. - Install dependencies
bun install && bun bun build
AFDIAN_CLIENT_ID=
AFDIAN_CLIENT_SECRET=
AFDIAN_CALLBACK_URL=
GITHUB_ID=
GITHUB_SECRET=
GITHUB__CALLBACK_URL=optional
ALIPAY_APP_ID=
ALIPAY_CALLBACK_URL=
ALIPAY_PRIVATE_KEY=
SESSION_KEY=optional
SESSION_SECRET=
- Cd to
apps/website
and init database with:npx wrangler d1 migrations apply sso --local
- Start with
bun run build && bun run dev
- Manually modify the database under
apps/website/.wrangler/state/v3/d1/miniflare-D1DatabaseObject
using SQLite software, change your first user typetype
toadmin
维护者 Owner: Willin Wang
如果您对本项目感兴趣,可以通过以下方式支持我:
Donation ways:
- Github: https://github.com/sponsors/willin
- Paypal: https://paypal.me/willinwang
- Alipay or Wechat Pay: QRCode
Apache-2.0