登録するログイン
ドキュメント価格設定
登録するログイン
  • はじめる
  • 導入
  • クイックスタート
  • SDK
  • React
  • TypeScript
  • Next.js
  • Express
  • NestJS
  • Python
  • APIリファレンス
  • サポートとリソース
  • よくある質問
  • 接触

クイックスタートガイド

AuthSafe認証を使って、わずか10分以内にアプリケーションを稼働させましょう。このガイドでは、安全な認証をアプリに統合するための重要な手順を順を追って説明します。

5~10分
React SDK
OAuth 2.0

始める前に

前提条件
  • Node.js 16以降
  • Reactアプリケーション
  • AuthSafeアカウント
  • クライアント認証情報を持つ登録済みアプリ
あなたが構築するもの
  • ログインとログアウトの流れ
  • OAuthコールバック処理
  • 認証済みユーザーセッション
  • 保護されたアプリ体験

ステップ1:アプリケーションを登録する

AuthSafeダッシュボードでアプリケーションを作成し、クライアントIDとリダイレクトURIをコピーしてください。

クライアントIDは安全に保管してください

クライアントIDはフロントエンドでの使用には安全ですが、ブラウザコード内でクライアントの秘密情報を決して公開しないでください。


ステップ2:SDKをインストールする

npm install authsafe-react
# or
yarn add authsafe-react
# or
pnpm add authsafe-react

ステップ3:認証プロバイダーの設定

AuthProvider でアプリをラップして AuthSafe を初期化し、認証状態を利用可能にします。

import { AuthProvider } from 'authsafe-react';

export default function RootLayout({ children }) {
  return (
    <AuthProvider
      config={{
        clientId: 'your-client-id-here',
        redirectUri: 'http://localhost:3000/callback',
        scope: ['openid', 'profile', 'email'],
        env: 'production',
      }}
    >
      {children}
    </AuthProvider>
  );
}

ステップ4:OAuthコールバックルートを追加する

リダイレクトを処理し、ユーザーのサインインを完了させるコールバックページを作成します。

'use client';

import { useOAuthCallback } from 'authsafe-react';

export default function CallbackPage() {
  const { isLoading, error } = useOAuthCallback();

  if (isLoading) return <div>Processing login...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return <div>Login successful! Redirecting...</div>;
}

完全な例

import { AuthProvider, useLogin, useAuth, useLogout } from 'authsafe-react';

function App() {
  return (
    <AuthProvider
      config={{
        clientId: 'your-client-id',
        redirectUri: 'http://localhost:3000/callback',
        scope: ['openid', 'profile', 'email'],
        env: 'production',
      }}
    >
      <YourApp />
    </AuthProvider>
  );
}

function LoginButton() {
  const { signinRedirect, isLoading } = useLogin();

  return (
    <button onClick={() => signinRedirect()} disabled={isLoading}>
      {isLoading ? 'Logging in...' : 'Login with AuthSafe'}
    </button>
  );
}

function UserProfile() {
  const { user, isAuthenticated } = useAuth();
  const { logout } = useLogout();

  if (!isAuthenticated) {
    return <LoginButton />;
  }

  return (
    <div>
      <h2>Welcome, {user?.name || user?.email}</h2>
      <button onClick={() => logout()}>Logout</button>
    </div>
  );
}

次のステップ

React SDK を探索する

フック、プロバイダーの設定、および本番環境での使用に必要なコンポーネントについて学びましょう。

React SDK ドキュメントを見る -&gt;

認証ガイド

スコープ、アクセス制御、およびアプリケーションリソースの保護方法を理解する。

承認書類を表示 -&gt;

APIリファレンス

エンドポイントの動作、リクエストパターン、レスポンス形式を詳しく調べます。

APIドキュメントを見る -&gt;


AuthSafe

Product

HighlightFeatureIntegrationPricingFAQ

Company

AboutBlogContact

Developer

DashboardDocumentation

Legal

Terms & ConditionsPrivacyComplianceShippingCancellationAI

© 2026 AuthSafe. All rights reserved.

私たちはあなたのプライバシーを尊重します

このウェブサイトでは、お客様の体験を向上させるために匿名の分析Cookieを使用しています。個人情報の保存や共有は一切行いません。分析トラッキングはいつでも許可または拒否できます。プライバシーポリシーをご覧ください。

匿名の分析Cookieを使用しています。個人情報は保存されません。プライバシーポリシーをご覧ください。