getOauth2AccessToken

suspend fun getOauth2AccessToken(productType: String, productSubscriptionKey: String, environment: String): Response<Oauth2AccessToken>

Retrieves an OAuth2 access token for the specified product type.

This function interacts with the authentication service to obtain an access token that can be used for subsequent API calls. The access token is essential for authenticating requests to the MTN MOMO API.

Return

A Response containing the obtained io.rekast.sdk.model.authentication.Oauth2AccessToken.

Parameters

productType

The type of product for which to obtain the OAuth2 access token.

productSubscriptionKey

The subscription key for the product.

environment

The API environment (e.g., production, sandbox).