Auth0 Home Blog Docs

Successful login in logs, 200 response, but no token info in payload

#1

I am trying to set up my first regular webapp. I serve a link for the user to click that directs to

https://myAuth0App.auth0.com/authorize?response_type=code&client_id=MyClientID&redirect_uri=http://mylocalserver/myApp/callback&scope=openid%20profile&state=MyState

When clicked the redirect to the callback URL is successful and in my server the route to the callback automatically triggers a POST request to

https://myAuth0App.auth0.com/token

I’m using a Rust server and reqwest so the actual function looks 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()

When I check the application logs in the Auth0 dashboard it shows a successful login. However, I am printing out the response to the server and see only

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”} })

Why am I not seeing something like:

{
  "access_token": "eyJz93a...k4laUWw",
  "refresh_token": "GEbRxBN...edjnXbL",
  "id_token": "eyJ0XAi...4faeEoQ",
  "token_type": "Bearer"
}

?