-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"400 Bad Request" using simple Graph API call over https #149
Comments
For clarification, if you don't include the token, the API should still return an error as JSON; the issue is somewhere in how RESTC-cpp is sending requests that is different than curl or a browser. Has anyone used RESTC with the Meta Graph API? |
I have no experience with this particular API. What I would do myself to troubleshoot it is:
|
Confirmed with Lynx and Curl that the API is happy with http1.0 and 1.1
Since the URL is https, I've been using the SSLKEYLOGFILE env variable to decode SSL/TLS packets in wireshark. As restc-cpp does not use libcurl, it seems sniffing restc-cpp decrypted packets is not possible. With wireshark, I've looked at the headers for chromium, firefox (http2), lynx (http1.0) and curl (http1.1) and nothing looks special (all four get the proper json response). I put the same headers into my code above as used in lynx, and the Bad Request result persists. I've included redacted info about the Get requests from wireshark for lynx and curl below for reference. Since these all use libcurl and work, and restc uses openssl or libressl, could that be the issue? Using openssl 1.1.1f-1ubuntu2.16 and confirm my restc-cpp is built with it: OPENSSL_SSL_LIBRARY /usr/lib/x86_64-linux-gnu/libssl.so Here is the lynx and curl output from wireshark for working calls to the API:
|
Looking closer, I found 2 issues.
I have created a branch with a new example,
|
Success! Indeed the issue was missing the .Argument() to pass the token. Note sure how I missed that! No headers appear to to be needed. Note that in the branch linked, there seems to be a typo on line 24 (a superfluous 's'):
Looks like this would be a good basis for a very simple example. Thank you! |
I've been trying to get RESTC-CPP to work with the Meta Graph API and I can't get anywhere. My GET request is simple: "https://graph.facebook.com/v15.0/me?access_token=[token]"
this works fine if I paste it right in the browser, and also using curl in a terminal:
curl -v -i -X GET "https://graph.facebook.com/v15.0/me?access_token=[token]"
I thought it may be headers, so I tried sending the headers sent by the browser and also those sent by curl.
In all cases when I try and do this in RESTC-cpp I get the error:
Except when I used the encoding header:
.Header("Accept-Encoding", "gzip, deflate, br")
Which results in a different error message:
Here is the output of my CURL call with verbose info (token redacted):
The only thing that stands out to me is the explicit "HTTP/2"...
Here's my current code, token redacted:
Any help appreciated.
The text was updated successfully, but these errors were encountered: