send Signed Challenge
Submits a signed challenge transaction to obtain JWT token.
This is the final step of the SEP-10 authentication flow. The signed challenge is sent to the server, which verifies the signatures and returns a JWT token.
HTTP Request:
POST {authEndpoint}
Content-Type: application/json
{
"transaction": "base64_signed_challenge_xdr"
}Content copied to clipboard
Server verification:
Validates transaction structure (same checks as client)
Verifies time bounds are still valid
Verifies client signature(s) are valid
Checks signing weight meets account threshold
Generates and signs JWT token
Returns token in response
Example - Submit signed challenge:
val authToken = webAuth.sendSignedChallenge(signedChallengeXdr)
println("Token: ${authToken.token}")
println("Account: ${authToken.account}")
println("Expires: ${authToken.exp}")
// Use token in API requests
httpClient.get("https://example.com/api/account") {
header("Authorization", "Bearer ${authToken.token}")
}Content copied to clipboard
Example - Handle submission errors:
try {
val authToken = webAuth.sendSignedChallenge(signedChallenge)
} catch (e: TokenSubmissionException) {
when {
e.message?.contains("401") == true -> {
// Signature verification failed
println("Invalid signatures or insufficient signing weight")
}
e.message?.contains("400") == true -> {
// Invalid transaction
println("Malformed transaction or expired challenge")
}
}
}Content copied to clipboard
Return
AuthToken containing JWT token and parsed claims
Parameters
signed Challenge Xdr
Base64-encoded signed challenge XDR
Throws
If submission fails or server returns an error