New to the API and I’m trying to enter a user’s credentials to authorize my app.
So far I have,
int main(int argc, char** argv){
CURL* curl;
CURLcode res;
prog = argv[argc-argc];
char* credentials[128] = {"name=USERNAME&password=PASSWORD"};
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if(curl){
curl_easy_setopt(curl, CURLOPT_URL, "https://api.twitch.tv/kraken/oauth2/authorize?response_type=code&client_id=CORRECT_CLIENT_ID&redirect_uri=https://localhost/&scope=user_read");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, credentials);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "atest/1.0");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
res = curl_easy_perform(curl);
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return EXIT_SUCCESS;
}
It seems like it’s getting to the authorization page but not POST’ing the user credentials to authorize with the given client_id.