# Oauth and user Id/login name

**URL:** <https://discuss.dev.twitch.com/t/oauth-and-user-id-login-name/18713>\
**Category:** API\
**Created:** [November 17, 2018, 4:57pm UTC](https://discuss.dev.twitch.com/t/oauth-and-user-id-login-name/18713 "2018-11-17T16:57:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Baychev](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/daniel_baychev/32/7165_2.png) [@Daniel\_Baychev](https://discuss.dev.twitch.com/u/Daniel_Baychev)\
**Post date:** [November 17, 2018, 4:57pm UTC](https://discuss.dev.twitch.com/t/oauth-and-user-id-login-name/18713/1 "2018-11-17T16:57:16Z")

</div>

Hello everyone,  
I want to ask something, but before that i would like to apologize if there is already a reference somewhere which I overlooked.  
My problem is fairly simple and it goes like this:  
I have a link for oauth token that goes like this href=“[https://id.twitch.tv/oauth2/authorize?response\_type=token&client\_id=](https://id.twitch.tv/oauth2/authorize?response_type=token&client_id=)…&redirect\_uri=http://localhost/TwitchPHP/unfollow.php&scope= analytics:read:extensions” and it works properly.  
When the user is redirected besides the token I need a user id or/and login name. Is it possible that auth page can give me that besides the token or if i can get it as a json page.  
I handled that before with a form, but that form can not give me the token…  
Again, excuse my ignorance I am fairly new with API and all of the backend programing !  
Any advice is Highly appreciated !

---

<div class="post-metadata">

**Author:** ![Daniel\_Baychev](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/daniel_baychev/32/7165_2.png) [@Daniel\_Baychev](https://discuss.dev.twitch.com/u/Daniel_Baychev)\
**Post date:** [November 17, 2018, 8:37pm UTC](https://discuss.dev.twitch.com/t/oauth-and-user-id-login-name/18713/2 "2018-11-17T20:37:20Z")

</div>

I am sorry for the stupid Question, I answered it myself  
For anyone interested or having the same problem -\> [https://dev.twitch.tv/docs/authentication/getting-tokens-oidc/#claims](https://dev.twitch.tv/docs/authentication/getting-tokens-oidc/#claims)

---

<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:** [November 18, 2018, 11:14am UTC](https://discuss.dev.twitch.com/t/oauth-and-user-id-login-name/18713/3 "2018-11-18T11:14:15Z")

</div>

Either use OIDC login, as you have found.

Or once you have got a token (without OIDC) perform a API lookup with the token against any of the user (kraken v3/v5 or helix) endpoints with the token and it returns the user.

Calling:

> **[Reference](https://dev.twitch.tv/docs/api/reference/#get-users)**
>
> Twitch Developer tools and services to integrate Twitch into your development or create interactive experience on twitch.tv.

With just a token, (don’t specifiy a user ID or login) will return the user identified by the token you have

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [December 18, 2018, 11:15am UTC](https://discuss.dev.twitch.com/t/oauth-and-user-id-login-name/18713/4 "2018-12-18T11:15:13Z")

</div>

Closed on December 18, 2018, 11:15am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
