Cannot get user id in local/hosted test

Thats expected, the opaqueID is essentially a session ID, so in the example of a game, you let a logged out player play level 1, then prompt to login (share their ID) to save their progress, as the opquaeID shouldn’t change during the login process.

The userID is encoded in the token itself

See

For an example, to extract the userID from a decoded JWT Token

Or for frontend usage

window.Twitch.ext.viewer.id

It’s considered bad practice to auto prompt, but you can do it

my example generates a “obvious” button for people to click

https://github.com/BarryCarlyon/twitch_profile_extension/raw/master/screenshots/awaiting_share.png

The function is window.Twitch.ext.actions.requestIdShare();