Skip to main content

AuthAdapter

SolvaPay SDK


SolvaPay SDK / react/src / AuthAdapter

Interface: AuthAdapter

Defined in: packages/react/src/adapters/auth.ts:15

Auth adapter interface for client-side authentication

Used by SolvaPayProvider to get auth tokens and user IDs. Adapters should handle their own error cases and return null when authentication is not available or fails.

Properties

getToken()

getToken: () => Promise<string | null>

Defined in: packages/react/src/adapters/auth.ts:25

Get the authentication token

Returns

Promise<string | null>

The auth token string if available, null otherwise

Remarks

This method should never throw. If authentication fails or is missing, return null and let the caller decide how to handle unauthenticated requests.


getUserId()

getUserId: () => Promise<string | null>

Defined in: packages/react/src/adapters/auth.ts:36

Get the authenticated user ID

Returns

Promise<string | null>

The user ID string if authenticated, null otherwise

Remarks

This method should never throw. If authentication fails or is missing, return null and let the caller decide how to handle unauthenticated requests.