I'm very new to low-level OAuth2, so it may be something I'm doing, but I've hit a bit of a problem running the examples:
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Parse(ExpectedFieldType("refresh_token", "string"))', src/libcore/result.rs:746
This is using the following example code:
fn main() {
let client = Client::<Installed>::new(
String::from("beep"),
String::from("boop"),
Some(String::from("http://example.com/"))
);
let http_client = Default::default();
let token = client.request_token(&http_client, "4/Dwu8lXSrdeT_Yy9xBVoNNVaNP8Xel7ikNoXXS6yixEo").unwrap();
// Fails here ^
println!("Request probably worked?");
println!("{}", token.access_token());
}
It's not overly clear from the examples what I should have put into request_token(), but it doesn't seem to matter here. Any data fails equally well. 😃
It seems to partially get through the authentication as I get this error if the code was already used:
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: OAuth2(OAuth2Error { code: InvalidGrant, description: Some("Code was already redeemed."), uri: None })', src/libcore/result.rs:746
Thoughts? Anything I should test or change?