Skip to main content
This page covers client configuration, the authentication model, and token management.

Client configuration

The PagFinanceClient receives a configuration object at construction time:

Configuration options

string
required
API host (Next.js proxy). Point it to your app today or to a dedicated BFF in the future. The contract stays the same.
string
required
Identifier of the application consuming the API.
object
Host application metadata.
string
Default blockchain used when not specified per call (for example, solana).

Authentication model (challenge-response, no crypto)

The Web3 login is a challenge-response in the SIWS (Sign In With Solana) style. The SDK orchestrates the whole flow, and the host application only provides a signer that signs the challenge with the user’s wallet:
Internally the flow is: POST /api/auth/challenge, then signer(challenge), then POST /api/auth/verify. There is no cryptography or key in the client. The only proof is the signature, and all the logic (nonce, verification, token issuance) lives on the server.

Providing a token obtained elsewhere

If you already have a JWT token (obtained through another channel or reused from a previous session), just hand it to the client:

Transparent re-login on 401

The SDK can sign in again automatically when the API responds 401, transparently to the application:
Authenticated endpoints require the JWT token to be present in the client, either via signIn or via setToken. Public endpoints (such as assets.acceptedCryptos) do not need a token.

Authentication methods

See the Method Reference for the complete list of resources and the Authentication API Reference for the underlying REST endpoints.