> ## Documentation Index
> Fetch the complete documentation index at: https://auth0-automated-translations-update.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# データベース接続にユーザー名ログインを追加する

> Auth0のデータベース接続でユーザー名を必須にし、ユーザーがメールアドレスと併せて、またはメールアドレスの代わりにユーザー名で登録・サインインするように設定します。

データベース接続では、ユーザーはメールアドレスではなくユーザー名でサインインできます。

<h2 id="require-username">
  ユーザー名を必須にする
</h2>

1. [Auth0 Dashboard > Authentication > Database](https://manage.auth0.com/#/connections/database) に移動します。

2. 編集する接続名を選択し、**Attributes** タブを選択します。

   <Frame>
     <img src="https://mintlify.s3.us-west-1.amazonaws.com/auth0-automated-translations-update/images/authentication/database/example/attributes.png" alt="データベース接続の Attributes タブ" />
   </Frame>

3. **Attributes** タブに **Username** が表示されていない場合は、**+ Add Attribute** を選択してから **Username** を選択し、**Username Configuration** ウィンドウを開きます。

   **Attributes** タブに **Username** が表示されている場合は、**Configure** を選択して **Username Configuration** ウィンドウを開きます。

4. **Allow Signup with Username** セクションで、**Off**、**Optional**、**Required** のいずれかを選択します。

   <Frame>
     <img src="https://mintlify.s3.us-west-1.amazonaws.com/auth0-automated-translations-update/images/authentication/database/example/attributes/username-configuration.png" alt="ユーザー名必須設定を有効または無効にする" />
   </Frame>

5. **Save** を選択して変更を保存します。

この設定がログイン画面にどう反映されるかを確認するには、**Try Connection** を選択します。**Allow Signup with Username** が **Required** に設定されている場合、新規ユーザーはサインアップ時にユーザー名とメールアドレスの両方を入力する必要があります。

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/auth0-automated-translations-update/docs/images/cdy7uua7fh8z/AiB37UZqyBPb8h55PZtzm/73e6fd0033f63f865c40f189db1620ef/2025-01-29_15-22-11.png" alt="ユーザー名付きのログインフォーム" />
</Frame>

その後、ユーザーはユーザー名またはメールアドレスのいずれかでログインできます。ユーザー名が必須でなかった時期に登録したユーザーには ユーザー名 フィールドが保存されていないため、メールアドレスでログインする必要があります。

<h3 id="username-length">
  ユーザー名の長さ
</h3>

ユーザー名のデフォルトの許容文字数は 1～15 文字です。ただし、<Tooltip tip="Auth0 Dashboard: サービスを設定するための Auth0 の主要製品。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> または <Tooltip tip="Management API: 顧客が管理タスクを実行できるようにする製品。" cta="用語集を見る" href="/docs/ja-jp/glossary?term=Management+API">Management API</Tooltip> v2 を使用すると、最小文字数と最大文字数を変更できます (最大 128 文字まで) 。

<h3 id="allowed-characters">
  使用可能な文字
</h3>

ユーザー名フィールドでは、次の文字を使用できます。

* 英数字 (アクセント記号は使用不可。自動的に小文字に変換されます) ;
* アットマーク (@)  (ただし、メールアドレスは使用できません) ;
* キャレット (^) ;
* ドル記号 (\$) ;
* ピリオド (.) ;
* 感嘆符 (!) ;
* グレーブアクセント (\`) ;
* ハイフン (-) ;
* 番号記号 (#) ;
* プラス記号 (+) ;
* シングルクォート (') ;
* チルダ (\~) ;
* アンダースコア (\_) ;

これ以外の文字や記号は使用できません。また、Auth0 はカスタムデータベースへの入力を検証したりサニタイズしたりしません。
