I'm sending a post request as part of authentication. The request is formulated like this:
let client = reqwest::Client::new();
client.post("https://listopf.auth0.com/oauth/token")
.header(reqwest::header::CONTENT_TYPE, "application/json")
.body(format!("{{\"grant_type\":\"authorization_code\",\"client_id\": \"{}\",\"client_secret\": \"mySecret\",\"code\": \"{}\",\"redirect_uri\": \"http://localhost:3030/app/callback\"}}", AUTH0ID, accesscode.code ))
.send()
The response I'm getting is
Ok(Response { url: “https://myapp.auth0.com/oauth/token”, status: 200, headers: {“date”: “Wed, 23 Jan 2019 14:35:42 GMT”, “content-type”: “application/json”, “content-length”: “1170”, “connection”: “keep-alive”, “x-auth0-requestid”: “862f8f4266d50e21ee26”, “x-ratelimit-limit”: “30”, “x-ratelimit-remaining”: “29”, “x-ratelimit-reset”: “1548254143”, “cache-control”: “private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0”, “pragma”: “no-cache”, “strict-transport-security”: “max-age=15724800”, “x-robots-tag”: “noindex, nofollow, nosnippet, noarchive”} })
but I'm expecting a response that includes some json with fields like this
{
"access_token": "eyJz93a...k4laUWw",
"refresh_token": "GEbRxBN...edjnXbL",
"id_token": "eyJ0XAi...4faeEoQ",
"token_type": "Bearer"
}
Is this something I'm doing wrong with reqwest?