Android
Installation
Add Library
Ensure that you have mavenCentral
listed in your project's buildscript repositories section:
buildscript {
repositories {
mavenCentral()
...
}
}
Add the following to your app's build.gradle file:
implementation 'com.authsignal:authsignal-android:0.1.7'
Initialization
import com.authsignal.push.*
...
val authsignal = AuthsignalPush("YOUR_TENANT_ID", "YOUR_REGION_BASE_URL")
You can find your client or tenant ID in the Authsignal Portal.
You must specify the correct base URL for your tenant's region.
Region | Base URL |
---|---|
US (Oregon) | https://challenge.authsignal.com/v1 |
AU (Sydney) | https://au-challenge.authsignal.com/v1 |
EU (Dublin) | https://eu-challenge.authsignal.com/v1 |
Push auth
Getting an access token
Before a device credential can be added, an access token should be requested server-side. This access token can then be passed to the iOS SDK to authorise adding a new device credential for the authenticated user.
For more info on how to request an access token see our server documentation.
Adding a device credential
authsignal.addCredential(accessToken)
Removing a device credential
authsignal.removeCredential()
Getting a challenge
val challengeId = authsignal.getChallenge()
Updating a challenge
val approved: Boolean = true // true if the user has approved the challenge
authsignal.updateChallenge(challengeId, approved)