Getting unusable UserId: Ucharacters.. vs U####### formats


#1

(U473893777 format vs UJtG5miCPq1u2ndO6tYeT user id format)

Hi all, thanks for all those details.
Working on a custom extension (overlay).
Everything setup, working. my test accounts whitelisted…

I have an issue in my frontend (overlay) JS code, when I try to get the info of the user.

When i test my extension with my channel account at auth I receive a “regular looking” user id:
U473893777
which i can use with kraken/helix to get more info about this user.

When i test my extension with another account (not the channel owner) at auth i receive a user looking like that
UJtG5miCPq1u2ndO6tYeT
which neither kraken/helix accepts.

Thanks in advance for any pointers.
Nick


#2

You can’t use an Opaque ID in place of a Twitch User ID for API requests.

Please read the docs about Opaque IDs: https://dev.twitch.tv/docs/extensions/required-technical-background/#opaque-ids

And what may also be helpful is to check the extension reference docs to learn where Opaque IDs are used, and where Twitch User IDs are used: https://dev.twitch.tv/docs/extensions/reference


#3

As Dist pointed these are opaque ID. Read the link provided to understand what it is

To get someone user’s ID you need to ask them to share their identity with window.Twitch.ext. requestIdShare

Once the user shares its ID you can get it at window.Twitch.ext.viewer.id


#4

Thanks for those pointers. (New to Twitch SDK coming from Mixer)
@Dist: Thanks.
@Breci : Thanks

Took me a while to figure it ou … but here is what I do now :

in onAuthorized i check if viewer is linked ( .viewer.isLinked)
if yes i get the userId in .viewer.id. and thus can use it to get username (usefull for my game).

if notLinked: i show an overlay with a button to open the requestIdShare() panel to the viewer.

So when she enables sharing my extensions gets reloaded this time with isLinked to true (if viewer granted).

So basically it is by mixing auth and viewer infos that the whole picture can be understood ?

Sorry for those noob questions, first extension…

Thanks
Nick


#5

You got it!