# Authenticating Users

Hyphen Authentication are provided in the [`at.hyphen:android-sdk-authenticate`](https://github.com/hyphen-at/hyphen-android-sdk/tree/main/authenticate) module of the SDK. You can sign in, create an account, or get the user's key and account information through this module.

{% hint style="info" %}
**Recovery Key Support for Android SDK is Currently in Beta**

As the SDK uses Google Play Credential Store to store recovery keys, it is required for the app to be published on Play Store in order to use the feature. If you want to access the feature, please feel free to reach out to <jun@meowauth.xyz>!
{% endhint %}

## Integrate Hyphen Authenticate

### Implementation `HyphenAuthenticateDelegate`&#x20;

You must implement the `HyphenAuthenateDelegate` interface from `Activity` class where you want to use Hyphen authentication.

{% tabs %}
{% tab title="YourActivity.kt" %}

<pre class="language-kotlin"><code class="lang-kotlin">class YourActivity: AppCompatActivity, <a data-footnote-ref href="#user-content-fn-1">HyphenAuthenticateDelegate</a> {
    
    // HyphenAuthenticateDelegate
    override var hyphenAuthenticateActivityResultLauncher: ActivityResultLauncher&#x3C;Intent> =
        (this as ComponentActivity).registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
            hyphenActivityResultCallback?.invoke(it)
        }

    // IMPORTANT: you must set null this value.
    override var hyphenActivityResultCallback: ((ActivityResult) -> Unit)? = null
}
</code></pre>

{% endtab %}
{% endtabs %}

### Authenticate with Google Account

{% hint style="info" %}
Currently, Hyphen SDK only support Google Account.&#x20;
{% endhint %}

You must use the Web Client ID on the Google Cloud Platform for Google Authentication. See also [**Get your Google API client ID**](https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid).

{% tabs %}
{% tab title="YourActivity.kt" %}

```kotlin
HyphenAuthenticate.authenticate(
    activity = activityContext,
    webClientId = "<YOUR-WEB-CLIENT-ID>" // ex. 201778913659-dn4bo82q6hce3kfp7vstp04b22nh5hbi.apps.googleusercontent.com
)
```

{% endtab %}
{% endtabs %}

### Get Hyphen Account

In authenticate successfully, you can get hyphen account.

{% tabs %}
{% tab title="YourActivity.kt" %}

<pre class="language-kotlin"><code class="lang-kotlin">val hyphenAccount = HyphenAuthenticate.getAccount(context = activityContext) // return object: <a data-footnote-ref href="#user-content-fn-2">HyphenAccount</a>
Log.e(hyphenAccount.addresses.first().address) // print "0x&#x3C;FLOW_ADDRESS>"
</code></pre>

{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}

[^1]: <https://github.com/hyphen-at/hyphen-android-sdk/blob/main/authenticate/src/main/kotlin/at/hyphen/android/sdk/authenticate/HyphenAuthenticateDelegate.kt>

[^2]: <https://github.com/hyphen-at/hyphen-android-sdk/blob/main/core/src/main/kotlin/at/hyphen/android/sdk/core/common/account/HyphenAccount.kt>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyphen.at/android/authenticating-users.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
