Skip to content

Commit 3645a80

Browse files
pseay-imbueSculptor
andcommitted
Restore the OAuth authorize scope request
RAMP_OAUTH_SCOPES is sent as the authorize URL's scope param (it determines what the agent key is granted), so it's used and stays -- just with a shorter comment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Sculptor <sculptor@imbue.com>
1 parent 924228f commit 3645a80

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

src/services/ramp.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,45 @@ const RAMP_OAUTH_CALLBACK_PATH = '/callback';
117117
/** Time to wait for the user to finish the hosted login + agent-key approval. */
118118
const RAMP_LOGIN_TIMEOUT_MS = 300_000;
119119

120+
/**
121+
* Scopes requested on the authorize URL: the agent-tools scope set Ramp's OpenAPI
122+
* declares. Ramp grants only the subset the signed-in user is entitled to (returned
123+
* in the token's `scope`), so over-requesting is harmless, but omitting a scope an
124+
* endpoint needs fails at call time with DEVELOPER_7100.
125+
*/
126+
const RAMP_OAUTH_SCOPES = [
127+
'accounting:read',
128+
'agent_account_numbers:read',
129+
'ai_spend:read',
130+
'applications:read',
131+
'applications:write',
132+
'approvals:write',
133+
'bank_accounts:read',
134+
'bills:read',
135+
'cards:read_agentic',
136+
'cards:write',
137+
'comments:write',
138+
'funds:write',
139+
'limits:read',
140+
'limits:write',
141+
'memos:read',
142+
'purchase_orders:read',
143+
'receipts:write',
144+
'reimbursements:read',
145+
'reimbursements:write',
146+
'tasks:read',
147+
'transactions:read',
148+
'transactions:write',
149+
'treasury:read',
150+
'trips:read',
151+
'trips:write',
152+
'unified_requests:read',
153+
'users:read',
154+
'vendors:read',
155+
'vendors:write',
156+
'x402:write',
157+
].join(' ');
158+
120159
/**
121160
* Browser login session: runs the OAuth authorization-code + PKCE flow in a
122161
* Playwright browser and returns OAuthCredentials. login() is overridden wholesale
@@ -181,6 +220,7 @@ class RampOAuthServiceSession extends ServiceSession {
181220
authUrl.searchParams.set('response_type', 'code');
182221
authUrl.searchParams.set('client_id', clientId);
183222
authUrl.searchParams.set('redirect_uri', redirectUri);
223+
authUrl.searchParams.set('scope', RAMP_OAUTH_SCOPES);
184224
authUrl.searchParams.set('state', randomUUID());
185225
authUrl.searchParams.set('code_challenge', codeChallenge);
186226
authUrl.searchParams.set('code_challenge_method', 'S256');

0 commit comments

Comments
 (0)