Skip to main content
Version: Node.js

Android SDK Reference

The Glide Android SDK provides two main functions:

  1. Generating an Auth URL: To begin the 3-legged OAuth flow the client can generate a url for itself to redirect the user to.
  2. Performing a Mobile Request: The client can be used to force a request to be made over the mobile network.

Their is also a convenience method to perform both of these steps in one call.

The authorization flow from the client's side ends with the client receiving an authorization code which can be exchanged for an access token on the backend.

The backend then uses this code to request an access token from the Glide API which can be used to make requests on behalf of the user.

GlideClient Reference

Initialization

To initialize the GlideClient, you need to provide an android Context so that the Glide SDK can interact with the Android system.

The full signature for the GlideClient constructor is:

GlideClient(
context: Context,
clientId: String? = null,
redirectUri: String? = null,
authUrl: String? = null
)

1. context

The context parameter is the Android context that the Glide SDK will use to interact with the Android system.

2. clientId

The clientId parameter is the Glide API Client ID. This is optional and only required if you are generating an authorization URL from the client side.

3. redirectUri

The redirectUri parameter is the Glide API Redirect URI. This can be omitted and and the system will use the registered redirect URI.

4. authUrl

The authUrl parameter is the Glide Internal Auth Base URL. This should only be provided if you are using a custom Glide environment.

Example

import com.glide.android.sdk.GlideClient

val glide = GlideClient(context, clientId = "your-client-id")

Properties

1. numberVerify

The numberVerify property provides access to the NumberVerifyClient for performing number-verification related operations.

NumberVerifyClient Reference

The NumberVerifyClient is used to interact with the Number Verify service. You don't need to initialize this class directly, instead, you can access it through the GlideClient instance.

Methods

1. generateAuthUrl

Description: generateAuthUrl creates a URL for the user to initiate a 3-legged OAuth flow. No parameters are required, but you can provide an optional state to connect the callback to the original request as well as a useDevNumber to use a test number instead of the user's IP based routing when testing with sandbox numbers.

Syntax:

fun generateAuthUrl(
options: NumberVerifyAuthUrlInput
): String

Parameters:

ParameterTypeDescription
optionsNumberVerifyAuthUrlInputAn object containing the auth URL options.

NumberVerifyAuthUrlInput Properties:

PropertyTypeDescription
stateStringOptional - A state parameter to pass to the redirect URL.
useDevNumberStringOptional - A phone number to use for testing instead of using IP based routing (only works for sandbox numbers)
printCodeBooleanOptional - A dev flag to print the code instead of redirecting to callback

Returns:

  • string: The URL for the user to initiate a number verification session. This URL should be opened on the user's device.

Example:

import com.glide.android.sdk.GlideClient

val glide = GlideClient(context, clientId = "your-client-id")
val authUrl = glide.numberVerify.generateAuthUrl(
NumberVerifyAuthUrlInput(state = "my-state")
)

2. startVerification

Description: startVerification initiates a number verification session for the user. This method generates an auth URL and opens it over the mobile network.

Syntax:

fun startVerification(
options: NumberVerifyAuthUrlInput,
delegate: TelcoRequestDelegate
): String

Parameters:

ParameterTypeDescription
optionsNumberVerifyAuthUrlInputAn object containing the auth URL options.
delegateTelcoRequestDelegateA delegate to handle the result of the request.

NumberVerifyAuthUrlInput Properties:

PropertyTypeDescription
stateStringOptional - A state parameter to pass to the redirect URL.
useDevNumberStringOptional - A phone number to use for testing instead of using IP based routing (only works for sandbox numbers)
printCodeBooleanOptional - A dev flag to print the code instead of redirecting to callback

TelcoRequestDelegate Properties:

PropertyTypeDescription
onResponseFunction(response: String, requestId: String)A function to handle the response from the request.
onErrorFunction(error: String, requestId: String)A function to handle any errors that occur during the request.

Returns:

  • String: The request ID for the verification session.

Example:

import com.glide.android.sdk.GlideClient

val glide = GlideClient(context, clientId = "your-client-id")

val requestId = glide.numberVerify.startVerification(
NumberVerifyAuthUrlInput(state = "my-state"),
object : TelcoRequestDelegate {
override fun onResponse(response: String, requestId: String) {
// Handle the response
}

override fun onError(error: String, requestId: String) {
// Handle the error
}
}
)