Hello, I have webhooks working and sending the get request from the twitch API of stream data going directly to my backend. Mydomain.com/api/webhookingest/. Now I am needing to do Auth so I am able to check subscribers and follow accounts. I found that I will need to do OAuth but I am new to OAuth. I am not sure what I need to do for my redirect. From what I understand I need to make the get request from JS and then do a POST request if the user Authorized? How do I open this page in a new window and close once it is open but be able to get the access token needed for the Auth of the API?
Authentication is covered here:
Step 1) Redirect user to Twitch, with scopes attached.
Step 2) User comes back to your website with a
code (or an error)
Step 3) You exchange the
code for an
access token via POST request
Step 4) You now have your oAuth for making requests
You need a page that access GET requests, to show a button to send the user to Twitch, and then that page needs to accept GET requests, to receive the query string code and perform the POST request and store the resulting keys (access token and refresh tokens if you intend to refresh)
Thank you I do understand all of that now. I just need to figure out how to open the redirect to twitch in another window. So right now I do have the webhooks going directly to my backend so I am not totally sure how to set the redirect to the frontend while still sending the webhooks to the backend.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.