Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ureq = ["dep:ureq"]

[dependencies]
async-trait = "0.1.74"
getset = "0.1.2"
getset = "0.1.7"
http = "1.0.0"
maybe-async = "0.2.10"
nutype = { version = "0.7.0", features = ["serde"] }
Expand Down
9 changes: 5 additions & 4 deletions examples/auth_code_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ mod async_impl {
// This example will be running its own server at 127.0.0.1:8114.
// See below for the server implementation.
.set_redirect_uri(
RedirectUrl::new("http://127.0.0.1:8114/redirect".to_string())
.expect("Invalid redirect URL"),
RedirectUrl::new("http://127.0.0.1:8114/redirect".to_string()).expect("Invalid redirect URL"),
);

// oauth2 bundles its own reqwest version, which may differ from the one
// minecraft-msa-auth is built against.
let oauth_http_client = oauth2::reqwest::Client::new();

// Microsoft supports Proof Key for Code Exchange (PKCE - https://oauth.net/2/pkce/).
// Create a PKCE code verifier and SHA-256 encode it as a code challenge.
// Create a PKCE code verifier and SHA-256 encode it as a code
// challenge.
let (pkce_code_challenge, pkce_code_verifier) = PkceCodeChallenge::new_random_sha256();

// Generate the authorization URL to which we'll redirect the user.
Expand Down Expand Up @@ -88,7 +88,8 @@ mod async_impl {
.exchange_code(code)
// Send the PKCE code verifier in the token request
.set_pkce_verifier(pkce_code_verifier)
.request_async(&oauth_http_client).await?;
.request_async(&oauth_http_client)
.await?;
println!("microsoft token:\n{:?}\n", token);

// Exchange the Microsoft token with a Minecraft token.
Expand Down
Loading