mardi 29 septembre 2015

Retrieving Data From URL After Authorization Redirect

I'm currently writing a small command-line program in C using LibCurl to retrieve authenticated-user-specific information (e.g. currently live streams the user follows) from Twitch using its API.

My program's calls and parsing work fine after I am able to get the user's token from the OAuth2.0 protocol used with Twitch.

My problem is figuring out a method to get a user's token if it has not been provided. Since Twitch doesn't allow password grant flow (i.e., POST a username and password to the authorization page and retrieving the token) the user must be redirected to the authorization web page, have them enter their credentials if they are not logged in, and authorize my application to be issued a code token (which is found in the URL when the user is redirected after authorizing).

Ideally, I wanted a user to be prompted by opening up the authorization web page in the user's default broswer, have the user log in and authorize my program. And then when the user is redirected, retrieve the new URL containing the code token. My problem is I'm relatively new to web programming and I'm just not sure how to go about implementing this solution or if it's even feasible.




Aucun commentaire:

Enregistrer un commentaire