Authorization Code Flow

To stop a page from being accessible it needs to be behind some kind of check for example.

  1. Auth with twitch sends redirect_url
  2. Login page/function captures the redirect
  3. Query Twitch API for user details
  4. Create a session that contains said details
  5. Pages check to see if a session is established

That is pretty much it in psuedo code. @BarryCarlyon did cover this further up! Are you using a framework or plain php?