Sep45TokenSubmissionException

class Sep45TokenSubmissionException(message: String, val statusCode: Int? = null, val errorMessage: String? = null) : Sep45Exception

Exception thrown when submitting signed authorization entries to obtain a JWT token fails.

This can occur for several reasons:

  • Network connectivity issues

  • Server returns HTTP error (400, 401, 403, 500, etc.)

  • Invalid response format from server

  • Missing JWT token in response

  • Server-side simulation/verification failed

  • Authorization entries signature verification failed

HTTP status codes and their meanings:

  • 400 Bad Request: Invalid authorization entries XDR or malformed request

  • 401 Unauthorized: Signature verification failed, insufficient signatures, or contract __check_auth rejected

  • 403 Forbidden: Contract account not allowed to authenticate

  • 404 Not Found: WebAuth endpoint not available

  • 500+ Server Error: Server-side issues

Common causes of 401 errors:

  • Missing required signatures (contract's __check_auth expects specific signers)

  • Invalid signatures (wrong keypairs used)

  • Authorization entries were modified after signing

  • Signature expiration ledger has passed

  • Contract's __check_auth implementation rejected the authentication

Example - Handle submission errors:

try {
val token = webAuth.sendSignedChallenge(signedEntries)
} catch (e: Sep45TokenSubmissionException) {
when (e.statusCode) {
401 -> {
println("Signature verification failed - check signers")
println("Error: ${e.errorMessage}")
}
400 -> println("Invalid authorization entries format")
else -> println("Server error: ${e.message}")
}
}

Constructors

Link copied to clipboard
constructor(message: String, statusCode: Int? = null, errorMessage: String? = null)

Properties

Link copied to clipboard
expect open val cause: Throwable?
Link copied to clipboard

Optional detailed error message from server

Link copied to clipboard
expect open val message: String?
Link copied to clipboard

HTTP status code (null for network errors)