Auth
Auth
認証・認可を管理する Feature
概要
Auth は Supabase Auth を利用したユーザー認証機能を提供する。メール/パスワード認証、OAuth、OTP(ワンタイムパスワード)、ユーザーの BAN 管理をサポートする。
API
Handler
| 関数 | 説明 |
|---|---|
signUp(client, input) | 新規ユーザー登録 |
signIn(client, input) | メール/パスワードでサインイン |
signInWithOAuth(client, input) | OAuth プロバイダーでサインイン |
sendOtp(client, input) | OTP を送信 |
verifyOtp(client, input) | OTP を検証 |
signOut(client) | サインアウト |
getUser(client) | 現在のユーザーを取得 |
banUser(client, input) | ユーザーを BAN |
unbanUser(client, input) | BAN を解除 |
Service
| 関数 | 説明 |
|---|---|
signUp(client, input) | ユーザー登録処理 |
signIn(client, input) | サインイン処理 |
signInWithOAuth(client, input) | OAuth サインイン処理 |
sendOtp(client, input) | OTP 送信処理 |
verifyOtp(client, input) | OTP 検証処理 |
signOut(client) | サインアウト処理 |
getUser(client) | ユーザー取得処理 |
banUser(client, input) | BAN 処理 |
unbanUser(client, input) | BAN 解除処理 |
Schema
| スキーマ | 型 | 説明 |
|---|---|---|
UserStatus | "active" | "banned" | ユーザーステータス |
AuthUserSchema | AuthUser | 認証ユーザー |
SignUpInputSchema | SignUpInput | 登録入力 |
SignInInputSchema | SignInInput | サインイン入力 |
OAuthProvider | "google" | "apple" | OAuth プロバイダー |
SignInWithOAuthInputSchema | SignInWithOAuthInput | OAuth 入力 |
SendOtpInputSchema | SendOtpInput | OTP 送信入力 |
VerifyOtpInputSchema | VerifyOtpInput | OTP 検証入力 |
BanUserInputSchema | BanUserInput | BAN 入力 |
UnbanUserInputSchema | UnbanUserInput | BAN 解除入力 |
使用例
import { Auth } from "@unitto/features";
// サインアップ
await Auth.Handler.signUp(client, {
email: "user@example.com",
password: "securePassword123",
});
// OAuth サインイン
await Auth.Handler.signInWithOAuth(client, {
provider: "google",
});
// 現在のユーザー取得
const user = await Auth.Handler.getUser(client);