I’m hooking into the twitch.onAuthorized() call to decode the auth.token value, and from there pull out the user_id value. I need this value for identifying users in the extension. However, for some reason on one of our developer accounts, the decoded token contains the user_id of any viewers who can see the extension, but on my account, when I decode the token the user_id is missing. Both accounts are using the same extension.
This is what I see when I decode the auth.token value:
Note that the user_id is missing. Anyone know why I’m not getting that field back, when on another developer’s account, his extension is getting back that field? Thanks!
First the extension has to have selected the option to request identity link in the Extension Capabilities section.
Then you can either use the requestIdShare helper function as mentioned in the docs https://dev.twitch.tv/docs/extensions/reference/#helper-actions or the user can click the permissions button for the extension (which is the bottom right of the panel for panel extensions, or for video extensions it can be found through the extensions icon at the bottom of the stream player).
Only once the user has agreed to share their identity (which they can later revoke if they choose to no longer share their ID with your extension) will the JWT include the user_id.