Getting a user's username through the Authorization Code Flow [php]

Hello all,

I am making a php app that needs to get a user’s username and OAuth token for authorization purposes. I have used the Authorization Code Flow to get an OAuth token, but I can’t figure out how to get their username in this process. All my website consists of at the moment is a “Connect with Twitch” button that will give me an authorization code, which I can then submit to along with my client id, client secret, and my redirect uri to get the OAuth.

I have read that I should be able to submit the access code to the root of the api to get username and other details, but whenever I try submitting the same request as above to I just get a “You are being redirected” message (to

Any help would be appreciated!

The flow you describe seems correct, so I’m unsure exactly what’s going wrong. Are you making sure to exchange the auth code for an oauth token? Can you give more details on the call you’re making to kraken?

Actually, I solved my own problem! My problem was that I was trying to submit a POST request to the api root, and wasn’t getting anything back. If I do a GET request, I get back what I need. Example:

file_get_contents('' . $oauth);