Authenticating Users

Use HyphenAuthenticate to sign in users

Hyphen Authentication are provided in the at.hyphen:android-sdk-authenticate module of the SDK. You can sign in, create an account, or get the user's key and account information through this module.

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!

Integrate Hyphen Authenticate

Implementation HyphenAuthenticateDelegate

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

class YourActivity: AppCompatActivity,  {
    
    // HyphenAuthenticateDelegate
    override var hyphenAuthenticateActivityResultLauncher: ActivityResultLauncher<Intent> =
        (this as ComponentActivity).registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
            hyphenActivityResultCallback?.invoke(it)
        }

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

Authenticate with Google Account

Currently, Hyphen SDK only support Google Account.

You must use the Web Client ID on the Google Cloud Platform for Google Authentication. See also Get your Google API client ID.

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

Get Hyphen Account

In authenticate successfully, you can get hyphen account.

val hyphenAccount = HyphenAuthenticate.getAccount(context = activityContext) // return object: 
Log.e(hyphenAccount.addresses.first().address) // print "0x<FLOW_ADDRESS>"

Last updated

Was this helpful?