Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: Log inputs and outputs for debugging OAuth2 authentication

$
0
0
Hello Roshuma,

Thanks for your reply. I have built a local test server to see the messages and I've tracked the authentication issue down to the very last step, but I am unable to debug it further.

It seems like retrieving the OAuth token works with the code above, but making the actual API request fails with the error 401 shown above. What surprises me is that once I have the token, I can use it to make a request using curl like so :
curl https://spreadsheets.google.com/feeds/spreadsheets/private/full?access_token=<the access token>
I've built a little Casablanca test program to try to reproduce the curl command :
int main()
{  
  http_client client(U("https://spreadsheets.google.com/"));
  uri_builder builder(U("/feeds/spreadsheets/private/full"));
  builder.append_query(U("access_token"),
                       U("<the request token>"));
  ucout << "Client base URI : " << client.base_uri().to_string() << "\n";
  http_response response =
    client.request(methods::HEAD, builder.to_string()).get();
  ucout << "Response " << response.to_string() << std::endl;
  return 0;
}
I get the 401 'Token invalid' response with this. What should I change in my test program to make it mimic the curl request ?

Thanks,

Romain

Viewing all articles
Browse latest Browse all 4845

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>