Open vmenezes599 opened 1 year ago
Please try the following:
Url url{"https://example.com"};
#if CPR_LIBCURL_VERSION_NUM >= 0x073D00
Response response = cpr::Get(url, Bearer{"the_token"});
#else
Response response = cpr::Get(url, Header{{"Authorization", "Bearer the_token"}});
#endif
Since you are using either 1.10.x or 1.9.x, Response response = cpr::Get(url, Bearer{"the_token"});
should also be enough.
That is exacly what I am already doing. The code is:
cpr::Response response = cpr::Get(
cpr::Url{url}, cpr::Parameters{{"name", content_name}},
cpr::Header{
{"Authorization", "Bearer " + oauth_token},
{"Client-Id", client_id}});
And
cpr::Response response = cpr::Get(
cpr::Url{url}, cpr::Parameters{{"name", content_name}},
cpr::Header{{"Client-Id", client_id}, cpr::Bearer{oauth_token}});
The return is 401 OAuth missing. The same code works with same version of cpr on linux. The difference is curl in windows is 7.83.1 and on linux 7.68.0.
Even if I chose to use the build-in curl I get same result on windows (OAuth missing) and works under linux.
Best,
I was trying to look into this and failed to obtain a bearer token for the Twitch API. Can you provide a link to some kind of docs detailing how I get one? I already registered an application and I have a Client-Id
Description
I am trying to autenticate using OAuth token and using cpr I get OAuth missing while trying to access twitch helix api. Manual call using curl works. I tried using the cpr::Bearer and cpr::Header
Here is the verbose reply:
Example/How to Reproduce
cpr::Session
to url http://api.twitch.tv/helix/gamesPossible Fix
No response
Where did you get it from?
GitHub (branch 1.10.0 & 1.9.x)
Additional Context/Your Environment