> ## Documentation Index
> Fetch the complete documentation index at: https://docs.replit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Replit AuthからClerkに移行する

> Agentを使用して、アプリのユーザーデータを保持したまま既存のReplit AuthアプリをClerk Authに移行します。

このガイドを使用して、既存の[Replit Auth](/ja/features/auth-and-identity/authentication)アプリを[Clerk Auth](/ja/features/auth-and-identity/clerk-auth)に移行します。Agentが対象アプリの移行を処理するため、既存ユーザーは自分のデータへのアクセスを引き続き利用できます。

<Note>
  この自動移行は、Replit Authを使用しているアプリ向けです。アプリが別の認証システムを使用している場合は、このフローを使用しないでください。
</Note>

## 移行を開始する

Agentの移行は常に新しいタスクで実行する必要があります。

移行は以下のいずれかの方法で開始できます。

### Agentから開始する

<Steps>
  <Step title="新しいタスクを作成する">
    サイドバーの\*\*+**を選択するか、**Cmd+Shift+P**（Mac）または**Ctrl+Shift+P\*\*（Windows）を押して、新しいタスクを作成します。

    <Frame caption="新しいタスクを計画する：やりたいことを説明すると、Agentがプランを作成します。">
      <img src="https://mintcdn.com/replit/HAkP_ROSRoShmzzT/images/workspace/auth/replit-auth-to-clerk-new-task.png?fit=max&auto=format&n=HAkP_ROSRoShmzzT&q=85&s=37874894a973063219f18ff14a409501" alt="サイドバーで新規タスク作成ボタンがハイライトされたNew taskビュー。Cmd Shift Pショートカットを示すツールチップと、Message Agentコンポーザーの上に表示されるPlan a new taskの空状態" width="1750" height="1948" data-path="images/workspace/auth/replit-auth-to-clerk-new-task.png" />
    </Frame>
  </Step>

  <Step title="Agentを使って移行する">
    新しいタスクで、アプリをReplit AuthからClerkに移行するようAgentに依頼します。
  </Step>
</Steps>

### Authペインから開始する

<Steps>
  <Step title="Toolsを開く">
    Project Editorで**Tools**を開きます。

    <Frame caption="Toolsタブを開くと、アクティブなツールと並んでツールリストが表示されます。">
      <img src="https://mintcdn.com/replit/HAkP_ROSRoShmzzT/images/workspace/auth/replit-auth-to-clerk-open-tools.png?fit=max&auto=format&n=HAkP_ROSRoShmzzT&q=85&s=08fa9a797fdaef123ad8097a04c48254" alt="Project EditorのToolsタブが開き、Publishing、Domains、Monitoring、Users & Authなどを含むツールリストがPublishingの概要の横に表示されている" width="1500" height="1018" data-path="images/workspace/auth/replit-auth-to-clerk-open-tools.png" />
    </Frame>
  </Step>

  <Step title="Users & Authを選択する">
    <Frame caption="ツールリスト内のUsers & Auth。">
      <img src="https://mintcdn.com/replit/HAkP_ROSRoShmzzT/images/workspace/auth/replit-auth-to-clerk-users-auth.png?fit=max&auto=format&n=HAkP_ROSRoShmzzT&q=85&s=301ed2722dba42beb848e02a47148aa3" alt="ツールリストでUsers & Authがハイライトされ、「Let users log in to your App using a prebuilt login page」というツールチップが表示されている" width="1154" height="1018" data-path="images/workspace/auth/replit-auth-to-clerk-users-auth.png" />
    </Frame>
  </Step>

  <Step title="Update nowを選択する">
    **Introducing a new Replit Auth**バナーで**Update now**を選択します。

    <Frame caption="Users & Authツールに、Introducing a new Replit Authバナーと Update now アクションが表示されている。">
      <img src="https://mintcdn.com/replit/HAkP_ROSRoShmzzT/images/workspace/auth/replit-auth-to-clerk-banner.png?fit=max&auto=format&n=HAkP_ROSRoShmzzT&q=85&s=c115f201dc69c4b014a7134145c27c4a" alt="Users & Authが選択されたProject Editorに、Update nowボタンを表示するIntroducing a new Replit Authバナーが表示されている" width="1220" height="764" data-path="images/workspace/auth/replit-auth-to-clerk-banner.png" />
    </Frame>
  </Step>

  <Step title="Ask agent to migrateを選択する">
    ダイアログで**Ask agent to migrate**を選択します。

    <Frame caption="移行の概要ダイアログでClerk Authの更新内容が説明され、Ask agent to migrateが提示される。">
      <img src="https://mintcdn.com/replit/HAkP_ROSRoShmzzT/images/workspace/auth/replit-auth-to-clerk-dialog.png?fit=max&auto=format&n=HAkP_ROSRoShmzzT&q=85&s=83d3d51db78ea750472bb5a98c989eb8" alt="Ask agent to migrateボタンがあるIntroducing a new Replit Authダイアログ" width="1259" height="790" data-path="images/workspace/auth/replit-auth-to-clerk-dialog.png" />
    </Frame>
  </Step>
</Steps>

### 移行プランを確認する

どちらの方法で開始しても、Agentは**Migrate from Replit Auth to Clerk**タスクを作成し、移行プランを準備します。タスクが進む前に**View plan**を選択してプランを確認してください。

<Frame caption="Migrate from Replit Auth to Clerkタスクは、移行プレイブックを確認できるようView planアクションから開始します。">
  <img src="https://mintcdn.com/replit/HAkP_ROSRoShmzzT/images/workspace/auth/replit-auth-to-clerk-task.png?fit=max&auto=format&n=HAkP_ROSRoShmzzT&q=85&s=91b6d45806c6d55e83b3579f7cdcb59a" alt="Migrate from Replit Auth to Clerkという名前のAgentタスクに、View planボタンと移行プレイブックのレビュー作業が表示されている" width="575" height="900" data-path="images/workspace/auth/replit-auth-to-clerk-task.png" />
</Frame>

Agentが作業している間は、アプリの認証コードやClerkの認証情報を変更しないでください。

## Agentが行うこと

Agentは以下の順序で移行を完了します。

1. アカウントのアイデンティティ情報やサポートされているサインイン認証情報を含む、Replit Authのユーザーデータを Clerk に移動します。
2. アプリを変更する前に、データ移行が完了するのを待ちます。
3. アプリのサインインとセッションロジックを更新し、アプリを再起動して、利用可能な自動チェックを実行します。

## アプリのデータはそのまま残ります

Agentが変更するのはアプリの認証コードのみです。アプリの既存のデータベースデータやスキーマは更新されません。テーブルとリレーションはそのまま維持されます。

既存のユーザーは、プロフィール、保存された作業内容、権限など、すでに所有しているレコードに引き続き紐付けられます。

## 所要時間

Agentの作業には10分から1時間程度かかると見込んでください。データ移行自体は、小規模なアプリでは数分、多数のユーザーを抱えるアプリでは最大数時間かかることがあります。Agentは、そのデータ移行が完了するまでアプリのコードの変更を開始しません。

## 移行後

公開する前に、Developmentで更新されたアプリをテストしてください。

1. 既存のアカウントでサインインし、保存されたデータが利用できることを確認します。
2. サインアウトして再度サインインします。
3. 新しいテストアカウントを作成し、想定どおりにアプリを使用できることを確認します。

## 追加リソース

* [Clerk Auth概要](/ja/features/auth-and-identity/clerk-auth) — ReplitでのClerk Authの仕組み
* [カスタム認証移行を計画する](/ja/features/auth-and-identity/custom-auth-migration) — カスタム認証システムからの移行を計画する
