Authorizing a page with twitch

Hello, I am interested in authorizing a page with twitch, a few users on the authorize page log in to twitch and the table has their id. How to do it?

Documentation is here

User/OIDC/Implcit auth examples here

TLDR:

  1. make a link,
  2. Send user to link
  3. User accepts authorization
  4. User comes back with a code
  5. exchange code for token
  6. use token against users API

You’d using something like the user_access_generator from my github

Im use “implicit_auth” but im only want user_id what i have to do?

You can either use the Get Users endpoint https://dev.twitch.tv/docs/api/reference#get-users and not specify any params which will cause it to return the user associated with that OAuth token (including their id).

Alternatively you can use the Validate Token endpoint https://dev.twitch.tv/docs/authentication#validating-requests which will also work to provide you the user_id associated with the token, and some data about the token itself such as scopes, client id, and expiration.

If their id is the only thing you need then either option will work to get you what you need.

You dont understand me, i only want id from this auth. Currently i have all in table.

Live Example

Source code

You do the implicit auth loop

Then use the access token with the Get Users endpoint as Dist mentions

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.