| ... | ... | @@ -97,6 +97,12 @@ fn registration(auth: &auth::Store, provider: &str) -> Result<(String, String)> |
| 97 | 97 | |
| 98 | 98 | async fn response_bytes(mut response: reqwest::Response) -> Result<Vec<u8>> { |
| 99 | 99 | if !response.status().is_success() || response.content_length().is_some_and(|n| n > 65536) { |
| 100 | eprintln!( |
| 101 | "guest provider response: {} {} status {}", |
| 102 | response.url().host_str().unwrap_or_default(), |
| 103 | response.url().path(), |
| 104 | response.status() |
| 105 | ); |
| 100 | 106 | return Err(Error::new( |
| 101 | 107 | 502, |
| 102 | 108 | "The provider couldn't complete sign-in. Return to Shale and try again.", |
| ... | ... | @@ -242,6 +248,7 @@ async fn exchange( |
| 242 | 248 | flow: &Value, |
| 243 | 249 | ) -> Result<(String, String)> { |
| 244 | 250 | let form = [ |
| 251 | ("client_id", client), |
| 245 | 252 | ("grant_type", "authorization_code"), |
| 246 | 253 | ("code", code), |
| 247 | 254 | ("redirect_uri", callback), |
| ... | ... | @@ -249,7 +256,7 @@ async fn exchange( |
| 249 | 256 | ]; |
| 250 | 257 | if provider == "github" { |
| 251 | 258 | let mut form = form.to_vec(); |
| 252 | | form.extend([("client_id", client), ("client_secret", secret)]); |
| 259 | form.push(("client_secret", secret)); |
| 253 | 260 | let token = json_bytes( |
| 254 | 261 | &response_bytes( |
| 255 | 262 | http.post("https://github.com/login/oauth/access_token") |