Authorizing with LibCurl in C

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 = curl_easy_init();

        curl_easy_setopt(curl, CURLOPT_URL, "");
        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));



    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.

Twitch employs the OAuth 2 spec and doesn’t allow apps to use the password grant flow, so you have no ability to POST your username and password to Twitch to get a token.

Follow the step by step instructions at on how to integrate Twitch authentication.

Ah, I see now. Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.