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.
Integrate Hyphen Authenticate
Implementation HyphenAuthenticateDelegate
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
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?