max / makenotwork
1 file changed,
+8 insertions,
-9 deletions
| @@ -139,13 +139,13 @@ impl SyncKitClient { | |||
| 139 | 139 | ) -> Result<(Uuid, Uuid)> { | |
| 140 | 140 | let redirect_uri = format!("http://127.0.0.1:{}/", redirect_port); | |
| 141 | 141 | ||
| 142 | - | let body = Bytes::from(serde_json::to_vec(&OAuthTokenRequest { | |
| 143 | - | grant_type: "authorization_code", | |
| 144 | - | code, | |
| 145 | - | redirect_uri: &redirect_uri, | |
| 146 | - | code_verifier, | |
| 147 | - | client_id: &self.config.api_key, | |
| 148 | - | })?); | |
| 142 | + | let form_params = [ | |
| 143 | + | ("grant_type", "authorization_code"), | |
| 144 | + | ("code", code), | |
| 145 | + | ("redirect_uri", &redirect_uri), | |
| 146 | + | ("code_verifier", code_verifier), | |
| 147 | + | ("client_id", &self.config.api_key), | |
| 148 | + | ]; | |
| 149 | 149 | ||
| 150 | 150 | // OAuth authorization codes are single-use. Retrying after a | |
| 151 | 151 | // network error would send an already-consumed code, producing a | |
| @@ -154,8 +154,7 @@ impl SyncKitClient { | |||
| 154 | 154 | let resp = check_response( | |
| 155 | 155 | self.http | |
| 156 | 156 | .post(&self.endpoints.oauth_token) | |
| 157 | - | .header("content-type", "application/json") | |
| 158 | - | .body(body) | |
| 157 | + | .form(&form_params) | |
| 159 | 158 | .send() | |
| 160 | 159 | .await?, | |
| 161 | 160 | ) |