Skip to main content

Standalone authentication

note

This API is available only to merchants with standaloneWallet access and walletSetup scope to the config token.

Introduction

The Authentication service is responsible for issuing and managing access tokens.

Key Features:

  • Provides a way to authenticate users through the login process.

Prerequisites

Before integrating the Standalone Authentication Service, ensure you have:

  • A valid Paysafe account with appropriate permissions.
  • Set up instructions for Paysafe SDK Android or iOS.

To get started, initialize the StandaloneAuthenticationService instance in your app as shown below:

import com.paysafe.wallet.android.core.wallet.Wallet

val authenticationService = Wallet.getInstance().getStandaloneAuthenticationService()

Login Workflow Overview

Login workflow diagramLogin workflow diagramLogin workflow diagramLogin workflow diagram

Login steps

info

These operations might require Strong Customer Authentication (SCA). Please read Strong Customer Authentication for more information on the process.

Step 1.

Use loginWithPassword or loginWithPin to obtain an access token and then pass it to the authenticate method of the wallet. They requires two specific parameters clientIdentifier and brandIdentity, both of which are provided by Paysafe.

Step 2.

If SCA is required, Wallet.WalletError.scaRequired / ScaRequiredException will be thrown. Follow the steps outlined in the section Handle Strong Customer Authentication (SCA) Challenges to confirm the event.

Step 3.

After the SCA event is accepted, repeat the request providing the scaDetails parameter.

Login with PIN
try {

// Login
val token = authentication.loginWithPin(
clientIdentifier = "C4JTpgmp3:XqIOmHdk",
brandIdentity = "finley",
request = PinTokenRequest(
username = "johnDoe123@example.com",
pin = "111222"
)
)

// Authenticate the wallet sdk
Wallet.getInstance().authenticate(AuthenticationConfiguration(token.accessToken))

// Your are done. Start using the wallet services
} catch (e: DataException) {
// Handle invalid credentials error
} catch (e: ScaRequiredException) {
// Solve Strong Customer Authentication challenge using e.authenticationEvent
// Call loginWithPin again, providing the scaDetails parameter
}
Login with password

A PasswordTokenRequest object.

try {

// Login
val token = authentication.loginWithPassword(
clientIdentifier = "C4JTpgmp3:XqIOmHdk",
brandIdentity = "finley",
request = PasswordTokenRequest(
username = "johnDoe123@example.com",
password = "PaS#w0rd."
)
)

// Authenticate the wallet sdk
Wallet.getInstance().authenticate(AuthenticationConfiguration(token.accessToken))

// Your are done. Start using the wallet services
} catch (e: DataException) {
// Handle invalid credentials error
} catch (e: ScaRequiredException) {
// Solve Strong Customer Authentication challenge using e.authenticationEvent
// Call loginWithPassword again, providing the scaDetails parameter
}