# Getting username by userID without EBS

**URL:** <https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251>\
**Category:** Extensions\
**Created:** [January 31, 2021, 7:40pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251 "2021-01-31T19:40:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![morskoyzmey](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@morskoyzmey](https://discuss.dev.twitch.com/u/morskoyzmey)\
**Post date:** [January 31, 2021, 7:40pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/1 "2021-01-31T19:40:31Z")

</div>

As helix is the only API allowed for extensions, I have to get some token to get linked user name.  
There is some kind of [token.payload] passed to onAuthorized, but unfortunately it doesn’t accepted as good token.  
Is it possible to get user name without having to dealing with generating JWT on backend?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [January 31, 2021, 7:44pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/2 "2021-01-31T19:44:20Z")

</div>

> [@morskoyzmey](#):
>
> Is it possible to get user name without havin

No.

This example describes a method to do what you are after

> **[GitHub - BarryCarlyon/twitch\_profile\_extension: A simple Twitch Extension to...](https://github.com/BarryCarlyon/twitch_profile_extension)**
>
> A simple Twitch Extension to cover the basics of using the JWT and EBS together to get Twitch API information - GitHub - BarryCarlyon/twitch\_profile\_extension: A simple Twitch Extension to cover th...

The JWT from the extension is passed to the EBS  
The EBS generates an App Access Token/Client Credentials token  
And uses the UserID from the JWT + the App Access Token to lookup the user on the API.

TLDR: you need an EBS

> [@morskoyzmey](#):
>
> As helix is the only API allowed for extensions

You mis intrepreted what I wrote on the thread you necro’ed

Use of kraken would _likely_ result in a deny, because it’s use is deprecated.

And you can’t call helix without an access token that you can’t generate in an extension front end to use with the API

---

<div class="post-metadata">

**Author:** ![morskoyzmey](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@morskoyzmey](https://discuss.dev.twitch.com/u/morskoyzmey)\
**Post date:** [January 31, 2021, 7:49pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/3 "2021-01-31T19:49:44Z")

</div>

The only call I need for my extension is getUserByID 🙂  
And I don’t want to be denied, that’s why I interpreted your message this way.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [January 31, 2021, 7:51pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/4 "2021-01-31T19:51:49Z")

</div>

> [@morskoyzmey](#):
>
> The only call I need for my extension is getUserByID 🙂

Then you need an EBS.

> [@morskoyzmey](#):
>
> And I don’t want to be denied, that’s why I interpreted your message this way.

If it passed verification, then your extension will break when Kraken gets removed.  
And since the review team knows Kraken will be removed.  
That would be probably why they would deny the extension that uses Kraken calls.

---

<div class="post-metadata">

**Author:** ![morskoyzmey](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@morskoyzmey](https://discuss.dev.twitch.com/u/morskoyzmey)\
**Post date:** [January 31, 2021, 7:53pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/5 "2021-01-31T19:53:22Z")

</div>

I understand. And thank you for your good example. Unfortunately I don’t use node.js 😛

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [January 31, 2021, 7:54pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/6 "2021-01-31T19:54:34Z")

</div>

You can use any language to run an EBS with.

It’s in NodeJS to just be a somewhat simple example.  
Since _everyone_ knows Javascript since you need Javascript to make calls in an extension anyway.

---

<div class="post-metadata">

**Author:** ![morskoyzmey](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@morskoyzmey](https://discuss.dev.twitch.com/u/morskoyzmey)\
**Post date:** [January 31, 2021, 7:58pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/7 "2021-01-31T19:58:38Z")

</div>

Yep, I just don’t want to use fat libraries with tons of dependencies for JWT. But I just found good 10-code-rows realisation. Thanks and have a nice day!

---

<div class="post-metadata">

**Author:** ![morskoyzmey](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@morskoyzmey](https://discuss.dev.twitch.com/u/morskoyzmey)\
**Post date:** [January 31, 2021, 8:35pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/8 "2021-01-31T20:35:29Z")

</div>

I’m feeling so foolish. I thought there is need of JWT generation, but I just found out that Extension has its own usual secret, so I can just make ordinary API requests. What the point generating JWT then?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [January 31, 2021, 8:36pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/9 "2021-01-31T20:36:35Z")

</div>

> [@BarryCarlyon](#):
>
> The JWT from the extension is passed to the EBS  
> The EBS generates an App Access Token/Client Credentials token  
> And uses the UserID from the JWT + the App Access Token to lookup the user on the API.

You decode the JWT from your frontend, to extract the userID in the JWT.

You only need to generate a JWT if using Extension Pubsub or the Config Service.

---

<div class="post-metadata">

**Author:** ![morskoyzmey](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@morskoyzmey](https://discuss.dev.twitch.com/u/morskoyzmey)\
**Post date:** [January 31, 2021, 8:40pm UTC](https://discuss.dev.twitch.com/t/getting-username-by-userid-without-ebs/30251/10 "2021-01-31T20:40:54Z")

</div>

Sorry, was confused by phrase “EBS generates an App Access … token”. It actually gets it from Twitch (as always). Your code was helpful to figure out it.
