> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-docs-event-stream-action-templates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

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

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

<Warning>
  2017年6月8日以降、新規テナントでは、ネイティブアプリケーションから行うユーザー名/メールアドレスとパスワードを使った認証がデフォルトで無効になります。代わりに、ユニバーサルログインを使用してWeb Authenticationを行うことが推奨されています。引き続き利用したい場合は、まずダッシュボードで［Password Grant Type（パスワード付与タイプ）］を有効にする必要があります。詳細については、「[アプリケーションの付与タイプ](/docs/ja-jp/get-started/applications/application-grant-types)」を参照してください。
</Warning>

## データベース接続でログインする

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

```lines theme={null}
authentication
    .login("username@domain.com", "a secret password", "my-database-connection")
    .start(object: Callback<Credentials, AuthenticationException> {
        override fun onSuccess(payload: Credentials) {
            // Logged in!
        }

        override fun onFailure(error: AuthenticationException) {
            // Error!
        }
    })
```

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

## データベース接続でサインアップする

データベース接続でサインアップするには、ユーザーのメールアドレス、パスワード、接続名を指定して`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) {
            // Signed Up & Logged in!
        }

        override fun onFailure(error: AuthenticationException) {
            // Error!
        }
    });
```
