Sep31ForbiddenException

class Sep31ForbiddenException(message: String, val statusCode: Int = 403, val rawResponseBody: String? = null) : Sep31Exception

Exception thrown when the Receiving Anchor returns HTTP 403 Forbidden.

Indicates a SEP-10 authentication failure as defined by the SEP-31 specification "Authentication" section: "Any API request that fails to meet proper authentication should return a 403 Forbidden response." Catch Sep31ForbiddenException for the spec-mandated path and Sep31UnauthorizedException for anchors that emit HTTP 401 for the same condition.

Common causes:

  • The SEP-10 JWT is valid but signed by a different anchor

  • The JWT claims do not satisfy the Receiving Anchor's authorization policy

  • The authenticated Sending Anchor has been suspended or rate-limited by the Receiving Anchor

Recovery actions:

  • Verify the SEP-10 JWT was issued by the same anchor advertised in stellar.toml

  • Contact the Receiving Anchor operator if the failure persists with a fresh JWT

Example - Handle forbidden:

try {
val info = sep31Service.info(jwt = jwt)
} catch (e: Sep31ForbiddenException) {
println("Access denied (HTTP ${e.statusCode}): ${e.message}")
}

See also:

Parameters

message

Sanitized error message extracted from the anchor response.

Constructors

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

Properties

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

Anchor response body for local debugging — see the rawResponseBody convention on Sep31Exception. null when no body was captured.

Link copied to clipboard

The HTTP status code returned by the Receiving Anchor (always 403 for this exception).

Functions

Link copied to clipboard
open override fun toString(): String