Hello there, I managed to authenticate via login on my app, and the URL returns the Token of the user who granted access, but how can I know the name of the channel or the user ID of the channel that logged in?
At this moment I only have the channel’s oauth token, I don’t have the name or user id. How to get them?
Thank you so much, i believe the Validate way can help me.
but, the endpoint: https://id.twitch.tv/oauth2/validate is returnig me only this:
{"client_id":"CLIENTID","scopes":null,"expires_in":5398949}
when he was suppose to return something like this:
{
"client_id": "wbmytr93xzw8zbg0p1izqyzzc5mbiz",
"login": "twitchdev",
"scopes": [
"channel:read:subscriptions"
],
"user_id": "141981764",
"expires_in": 5520838
}
Why is it not returning all the information?
Then you generated a client credentials token
Not a user token.
Im sorry i dont get it, the code on response url after login:
https://localhost/3000?code=HERE&scope=channel%3Amanage%3Apolls+channel%3Aread%3Apolls
is not an user token? now i tried to use the Get Users endpoint and i got:
{“error”:“Bad Request”,“status”:400,“message”:“The id or login query parameter is required unless the request uses a user access token.”}
Well, i just want to return the channal name or the channel id from the code on the URL that the login returned to me,
Doesn’t this code work for that?
That code is a one use code to be exchanged for a token
Normally done as a server request as it requires the client secret to perform the code to token exchange.
I Got it!
so i have to POST this code on https://id.twitch.tv/oauth2/token
to get the acesse token, and with this acess token i can use https://id.twitch.tv/oauth2/validate to get user name.
Thank you.