Stellar PHP SDK API Documentation

SubmitContractChallengeResponse

Response from the SEP-45 token endpoint after submitting signed authorization entries.

This response is returned by the authentication server when a client submits signed authorization entries (POST to the WEB_AUTH_FOR_CONTRACTS_ENDPOINT). The response either contains a JWT token for successful authentication or an error message.

Response Fields:

  • token: JWT token for authenticated session (present on success)
  • error: Error message describing why authentication failed (present on failure)

JWT Token Structure: The JWT token contains the following claims:

  • iss: Issuer (authentication server URI)
  • sub: Subject (client contract account C... address)
  • iat: Issued at timestamp
  • exp: Expiration timestamp
  • client_domain: Optional client domain if verification was performed

Usage: After submitting signed authorization entries, check if the response contains a token or an error. If successful, the token can be used to authenticate subsequent requests to protected services (SEP-12, SEP-24, SEP-31, etc.).

Error Handling: If an error is present, it indicates the server rejected the signed authorization entries. Common reasons include invalid signatures, expired signatures, nonce reuse, or unauthorized contract accounts.

Security: Store JWT tokens securely and never expose them in logs or URLs. Tokens grant access to authenticated services and should be treated as credentials. Respect token expiration times.

Tags
see
https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0045.md

SEP-45 Token Response

see
WebAuthForContracts::sendSignedChallenge()

For submitting signed entries

Table of Contents

Methods

fromJson()  : SubmitContractChallengeResponse
Creates a SubmitContractChallengeResponse from JSON data.
getError()  : string|null
Returns the error message if authentication failed.
getJwtToken()  : string|null
Returns the JWT token if authentication was successful.
setError()  : void
Sets the error message.
setJwtToken()  : void
Sets the JWT token.

Methods

getError()

Returns the error message if authentication failed.

public getError() : string|null
Return values
string|null

the error message, or null if authentication was successful

getJwtToken()

Returns the JWT token if authentication was successful.

public getJwtToken() : string|null
Return values
string|null

the JWT token, or null if authentication failed

setJwtToken()

Sets the JWT token.

public setJwtToken(string|null $jwtToken) : void
Parameters
$jwtToken : string|null

the JWT token


        
On this page

Search results