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

**URL:** <https://staging-discuss.dev.twitch.com/t/getting-unusable-userid-ucharacters-vs-u-formats/23604>\
**Category:** Extensions\
**Created:** [December 29, 2019, 4:28pm UTC](https://staging-discuss.dev.twitch.com/t/getting-unusable-userid-ucharacters-vs-u-formats/23604 "2019-12-29T16:28:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwgdev](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jwgdev](https://staging-discuss.dev.twitch.com/u/jwgdev)\
**Post date:** [December 29, 2019, 4:28pm UTC](https://staging-discuss.dev.twitch.com/t/getting-unusable-userid-ucharacters-vs-u-formats/23604/1 "2019-12-29T16:28:52Z")

</div>

(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

---

<div class="post-metadata">

**Author:** ![Dist](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://staging-discuss.dev.twitch.com/u/Dist)\
**Post date:** [December 29, 2019, 4:44pm UTC](https://staging-discuss.dev.twitch.com/t/getting-unusable-userid-ucharacters-vs-u-formats/23604/2 "2019-12-29T16:44:27Z")

</div>

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](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](https://dev.twitch.tv/docs/extensions/reference)

---

<div class="post-metadata">

**Author:** ![Breci](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/breci/32/5635_2.png) [@Breci](https://staging-discuss.dev.twitch.com/u/Breci)\
**Post date:** [December 29, 2019, 6:43pm UTC](https://staging-discuss.dev.twitch.com/t/getting-unusable-userid-ucharacters-vs-u-formats/23604/3 "2019-12-29T18:43:27Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![jwgdev](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jwgdev](https://staging-discuss.dev.twitch.com/u/jwgdev)\
**Post date:** [December 30, 2019, 3:56am UTC](https://staging-discuss.dev.twitch.com/t/getting-unusable-userid-ucharacters-vs-u-formats/23604/4 "2019-12-30T03:56:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [December 30, 2019, 10:42am UTC](https://staging-discuss.dev.twitch.com/t/getting-unusable-userid-ucharacters-vs-u-formats/23604/5 "2019-12-30T10:42:50Z")

</div>

> [@jwgdev](#):
>
> So basically it is by mixing auth and viewer infos that the whole picture can be understood ?

You got it!
