Overview
@grantex/adapters provides pre-built adapters for popular APIs — Google Calendar, Gmail, Stripe, and Slack. Each adapter verifies grant tokens offline (JWKS), checks scopes, enforces constraints, and calls the upstream API.
Google Calendar
Scopes:calendar:read, calendar:write
Gmail
Scopes:email:read, email:send
Stripe
Scopes:payments:read, payments:initiate
Supports constraint enforcement — payments:initiate:max_500 limits payments to $500.
Slack
Scopes:notifications:send, notifications:read
Constraint Enforcement
Scopes can include constraints that adapters enforce automatically:Dynamic Credentials
Pass an async function instead of a static string:Audit Logging
Connect adapters to Grantex audit:Grant token audience
Every adapter checks the token’saud claim
(RFC 7519 section 4.1.3)
with the same semantics as enforce() in the SDKs, right after the signature
and before the upstream call. aud may be a string or an array of strings and
matches when the configured audience is one of its values, compared as exact
strings.
To keep the earlier behaviour while you find the audience, pass
audienceCheck: 'off', and remove it once audience is set.
Building Custom Adapters
ExtendBaseAdapter to integrate any API: