I'm converting some Ruby RestForce code to run standalone in Rust across platforms without runtime dependencies, and running into a bit of a problem:
Failed to tauthenticate due to TokenError(
TokenErrorResponse {
error: "invalid_grant",
error_description: "authentication failure",
},
)
The code throwing this is:
struct SalesForceParams {
username: String,
password: String,
client_id: String,
client_secret: String,
security_token: String,
login_endpoint: String,
}
impl SalesForceParams {
fn test_params() -> Self {
Self {
username: String::from("email@somewhere.nul"),
password: String::from("REDACTED"),
client_id: String::from("REDACTED"),
client_secret: String::from("REDACTED"),
security_token: String::from("REDACTED"),
login_endpoint: String::from("https://test.salesforce.com"),
}
}
}
...
let sf_params = SalesForceParams::test_params();
let mut client = Client::new(sf_params.client_id, sf_params.client_secret);
client.set_login_endpoint(&sf_params.login_endpoint);
client.set_access_token(&sf_params.security_token);
let res = client.login_with_credential(sf_params.username,sf_params.password).await;
match res {
Ok(r) => println!("Authenticated successfully"),
Err(err) => println!("Failed to tauthenticate due to {:#?}", err)
}
The values for those parameters are ripped out of the Ruby code - copy pasted, and the Ruby version does authenticate correctly. What am i doing wrong here?
I'm converting some Ruby RestForce code to run standalone in Rust across platforms without runtime dependencies, and running into a bit of a problem:
The code throwing this is:
The values for those parameters are ripped out of the Ruby code - copy pasted, and the Ruby version does authenticate correctly. What am i doing wrong here?