Getting twitch username during oAuth process


I’m creating an app app which involves Twitch IRC. In order to do this I need a couple of bits of information:

  1. The oAuth token
  2. The twitch username of the user

I’ve successfully managed to obtain the oAuth token through the ‘implicit grant flow’ by extracting it from ‘document.location.hash’ in the url as outlined in the link:

However this information does not include the username of the user which is required to connect to IRC. In order to connect I would need to ask the user to enter their username again into my app?

Is there any way to get the twitch username through the oAuth process?

Many thanks for your help

Once you have the oauth token it is a simple API call to get the username. A simple get request to the root api ( will return the username.


1 Like

Thanks so much! I had looked through the api files as I thought there must be something like that but must have missed it.