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

> Auth0.Android でデータベース接続を使用する方法

# Auth0.Android のデータベース認証

<Warning>
  2017 年 6 月 8 日以降、新しいテナントでは、ネイティブアプリケーションからの Username/Email とパスワードによる認証はデフォルトで無効になっています。代わりに Universal Login を使用して、Web Authentication を実行することを推奨します。それでも続行する場合は、まずダッシュボードで Password Grant Type を有効にする必要があります。詳細については、[Application Grant Types](/ja/docs/get-started/applications/application-grant-types) を参照してください。
</Warning>

<div id="log-in-with-a-database-connection">
  ## データベース接続でログインする
</div>

データベース接続でログインするには、ユーザーの**メールアドレス**、**パスワード**、および認証に使用する**接続**を指定して `login` を呼び出します。レスポンスとして `Credentials` オブジェクトが返されます。

```kotlin lines theme={null}
authentication
    .login("username@domain.com", "a secret password", "my-database-connection")
    .start(object: Callback<Credentials, AuthenticationException> {
        override fun onSuccess(payload: Credentials) {
            // ログインしました！
        }

        override fun onFailure(error: AuthenticationException) {
            // エラー！
        }
    })
```

デフォルトのスコープは `openid profile email` です。

<div id="sign-up-with-a-database-connection">
  ## データベース接続を使用してサインアップする
</div>

データベース接続を使用してサインアップするには、ユーザーのメールアドレス、パスワード、接続名を指定して `signUp` メソッドを呼び出します。

```kotlin lines theme={null}
authentication
    .signUp("username@domain.com", "a secret password", "my-database-connection")
    .start(object: Callback<Credentials, AuthenticationException> {
        override fun onSuccess(result: Credentials) {
            // サインアップ & ログイン完了！
        }

        override fun onFailure(error: AuthenticationException) {
            // エラー！
        }
    });
```
