Forge Docs
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"ユーザーステータス
AuthUserSchemaAuthUser認証ユーザー
SignUpInputSchemaSignUpInput登録入力
SignInInputSchemaSignInInputサインイン入力
OAuthProvider"google" | "apple"OAuth プロバイダー
SignInWithOAuthInputSchemaSignInWithOAuthInputOAuth 入力
SendOtpInputSchemaSendOtpInputOTP 送信入力
VerifyOtpInputSchemaVerifyOtpInputOTP 検証入力
BanUserInputSchemaBanUserInputBAN 入力
UnbanUserInputSchemaUnbanUserInputBAN 解除入力

使用例

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);

On this page