()
| 179 | * @returns Object containing access token and organization UUID |
| 180 | */ |
| 181 | export async function prepareApiRequest(): Promise<{ |
| 182 | accessToken: string |
| 183 | orgUUID: string |
| 184 | }> { |
| 185 | const accessToken = getClaudeAIOAuthTokens()?.accessToken |
| 186 | if (accessToken === undefined) { |
| 187 | throw new Error( |
| 188 | 'Claude Code web sessions require authentication with a Claude.ai account. API key authentication is not sufficient. Please run /login to authenticate, or check your authentication status with /status.', |
| 189 | ) |
| 190 | } |
| 191 | |
| 192 | const orgUUID = await getOrganizationUUID() |
| 193 | if (!orgUUID) { |
| 194 | throw new Error('Unable to get organization UUID') |
| 195 | } |
| 196 | |
| 197 | return { accessToken, orgUUID } |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Fetches code sessions from the new Sessions API (/v1/sessions) |
no test coverage detected