Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ak-cli/src/auth/claude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub struct CredentialsOpts {

#[derive(Serialize)]
struct ClaudeTokenExchange {
grant_type: String,
assertion: String,
federation_rule_id: String,
organization_id: String,
service_account_id: String,
Expand Down Expand Up @@ -91,14 +93,15 @@ pub async fn get_credentials(
let res: ClaudeTokenResponse = client
.post("https://api.anthropic.com/v1/oauth/token")
.json(&ClaudeTokenExchange {
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer".to_string(),
assertion: res.access_token,
federation_rule_id: opts.federation_rule_id,
organization_id: opts.organization_id,
service_account_id: opts.service_account_id,
workspace_id: opts.workspace_id,
})
.send()
.await?
// curl -sS happily returns error bodies, fail loudly instead
.error_for_status()?
.json()
.await?;
Expand Down
Loading