项目身份验证是应用程序用户身份层。每个项目都会收到自己的可发布密钥、用户、身份、会话、签名密钥、重定向策略、电子邮件传送和 OAuth 应用程序。
#项目身份边界
| 身份 | 所有者 | 目的 |
|---|---|---|
| HALO 帐户用户 | HALO | 访问开发人员仪表板 |
| 项目身份验证用户 | 您的项目 | 登录您的应用程序 |
| 上游提供商身份 | Google、Apple、GitHub、Microsoft | 验证项目用户 |
| OAuth 应用客户端 | 您的项目 | 请求对已登录项目用户的范围访问 |
#电子邮件快速入门
- 1配置 URL
设置站点 URL 以及项目可能使用的每个确切的重定向 URL。
- 2配置电子邮件
添加Resend发送密钥、已验证的发件人地址以及三个必需的 HTML 模板。
- 3复制可发布密钥
仪表板身份验证部分显示公共端点使用的项目密钥。
- 4创建用户会话
Create the SDK client once, then sign up or sign in through
halo.auth. The SDK persists the browser session and rotates refresh tokens automatically.
import { createClient } from "agihalo-node-sdk/auth";
const halo = createClient(
"https://api.agihalo.com",
HALO_PROJECT_PUBLISHABLE_KEY
);
const { data, error } = await halo.auth.signInWithPassword({
email: "user@example.com",
password: "use-a-strong-password",
});
if (error) throw error;
// The SDK automatically sends apikey + Bearer <access_token>.
const { data: currentUser } = await halo.auth.getUser();#公共 API
GET
/api/v1/auth/settingsPOST
/api/v1/auth/signupPOST
/api/v1/auth/token?grant_type=passwordPOST
/api/v1/auth/token?grant_type=refresh_tokenGET
/api/v1/auth/userPOST
/api/v1/auth/logoutGET
/api/v1/auth/.well-known/jwks.json