twitch Getting an OAuth token using the Authorization Code Flow Get the authorization code from the query string


When the user goes to the authorization endpoint, they will be asked to give your application permission to the scopes that you've requested. They can decline this, so you must make sure to take that into consideration in your code. After they've allowed your application access, the user will be redirected to the URL you specified in redirect_uri. The query string will now have a code parameter, which is the authorization code that you can exchange for an OAuth token.

  $authCode = $_GET['code'];