Would someone be able to provide a skeleton or another resource for a js setup?
Thank you for the help
CURL is basically a HTTP request.
As an example of the OAuth Authorization code flow you will redirect the user to
https://id.twitch.tv/oauth2/authorize?client_id=<your client ID>&redirect_uri=<your registered redirect URI>&response_type=code&scope=<space-separated list of scopes>
This’ll send the user to Twitch and ask them if they want to authorize your app, if they do they’ll be redirect back to the redirect URL you’ve set along with a
code parameter in the querystring, eg
https://<your registered redirect URI>/?code=<authorization code>.
Using that code you’ll make a HTTP POST request like
https://id.twitch.tv/oauth2/token?client_id=<your client ID>&client_secret=<your client secret>&code=<authorization code received above>&grant_type=authorization_code&redirect_uri=<your registered redirect URI>
Twitch will respond to that POST request with a reply containing the access token, refresh token, expiration etc… for you to do what you intend to do with. At this point the user has connected to your app and if you’re using it as a way to login to your site you’ll likely want to create a session for that user and store the tokens in your database.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.