Email not returned with GetUsers

So basically for some reason when i do te getUsers with an access token, it returns all basic information unless the email. im using the scope “user:read:email”.
The interesting fact is that a couple months ago it used to work.
Here’s the code to get the access token:

Here’s the url generated:

Your redirect URI (that you are sending people to) doesn’t look right, since it start with https://www.twitch.tv/login instead of something like

https://id.twitch.tv/oauth2/authorize?client_id=hozgh446gdilj5knsrsxxz8tahr3koz&redirect_uri=https%3A%2F%2Fbarrycarlyon.github.io%2Ftwitch_misc%2Fauthentication%2Fimplicit_auth%2F&response_type=token&scope=user:read:email

as per my implicit auth example https://barrycarlyon.github.io/twitch_misc/authentication/implicit_auth/

Your PHP(?) code does look correct however. I’m assuming you are using the Users reutned oAuth token to call the users API (not speicifing a ID or login just the token) as the user lookup code isn’t in your screenshot.

At time of writing my implicit oAuth example is working. So there is a code fault somewhere yourside.

my url does start with https://id.twitch.tv/oauth2/authorize
here :
https://id.twitch.tv/oauth2/authorize?client_id=mk1f6m29hrqzdu8hwqfydg5r6lrf3l&redirect_uri=ht […]
the thing is that it works. It returns info about the user but definetly not the email

The URL is incomplete!

I’m thinking that you did not URL encode the redirect URI. So the problem is that you never actually requested the scope. As it gets tacked onto the end of your redirect URI instead of being correctly passed to Twitch

So

$url = 'https://id.twitch.tv/oauth2/authorize?client_id=mk1f6m29hrqzdu8hwqfydg5r6lrf3l&redirect_uri=' . urlencode('https://yourredirect/') . '&scope=user:read:email'

so that should be the correct url?

the URL you copy pasted was

https://id.twitch.tv/oauth2/authorize?client_id=mk1f6m29hrqzdu8hwqfydg5r6lrf3l&redirect_uri=ht

I provided my suggested fix, you need to urlencode your redirect URI

So your $params above becomes something like

$params = array(
    'client_id' => $this->client_id,
    'redirect_uri' => urlencode($redirectUri),
    'response_type' => 'code',
    'scope' => 'user:read:email',
    'state' => $_SESSION['twitch_stage']
);

anyways in my php code i do the htpp_build_query()
https://www.php.net/manual/es/function.http-build-query.php
i have tried encoding the redirect but it goes wrong due to it being not valid

this I tried and it goes wrong

So what is the actual URL that your code is generating to redirect users to in order to authenticate?

this:

Twitch text`

by the way now i added the scope user:edit to see what happens. Now this finally shows up:

it basically says that if the user authorizes it, my web will be able to:
->update that user profile
->get that user email.

After i do authorize, i still don’t get the email

here is basically the response from twitch:

That looks correct,

you then did call thje users API with the access token?

Something like

it is worth noting that if you have an access token for “temperrino” but “termperrino”'s email is not verified, then it won’t be returned (regardless of the scope) in the response as the email is not verified.

I think it is verified since it is my personal account and actually this of the email thing had already worked in my web but now it stoped working.
I’m going to double check that

Since it’s your account try against “not your code” on the relevant link on Twitch Implicit Auth Example

and see if it returns on my implcict auth example

As the endpoint is working fine for me here

it was the goddamit verify thing. Twitch somehow updated something and required a new verification. Fuking thank you gosh. Been so desperate i came here. Just thank you. Have a great day, week and life. God bless you

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