SolvapayAuthAdapter
SolvaPay SDK / auth/src / SolvapayAuthAdapter
Class: SolvapayAuthAdapter
Defined in: packages/auth/src/solvapay.ts:23
SolvaPay authentication adapter
Validates tokens by calling the SolvaPay userinfo endpoint. This is required for opaque tokens which cannot be verified offline.
Implements
Constructors
Constructor
new SolvapayAuthAdapter(
config):SolvapayAuthAdapter
Defined in: packages/auth/src/solvapay.ts:26
Parameters
config
Returns
SolvapayAuthAdapter
Methods
getUserIdFromRequest()
getUserIdFromRequest(
req):Promise<string|null>
Defined in: packages/auth/src/solvapay.ts:30
Extract the authenticated user ID from a request.
This method should:
- Never throw exceptions (return null on failure)
- Handle missing/invalid authentication gracefully
- Work with both Request objects and objects with headers
Parameters
req
Request object or object with headers
Request | RequestLike
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.