Oauth for Helix endpoint

Hi,

I’m trying to get data from that user with OAuth authorization code flow.
I get my access_token in first response then i try to call the endpoint with it but i get a 401 in my log


I try to understand why but i miss the point.
Am i passing wrong params in header ?

I tried to find example of how i can accomplish that but didn’t find anything relevant

Thank you in advance for your time

You need a space between the token type and the token, it looks like your code will be sending them as Bearer1234 rather than Bearer 1234

And AUTH.token_type returned by the APU is bearer where Bearer is correct

So it’s

‘Authorization’: 'Bearer ’ + AUTH.access_token

1 Like

Oh right ! I really need to double check my code … Thank you

Then i have another question for you
With users?login=“xx” i can get the id of a certain streamer then i need to call streams/user_id=“xxxx” to know if the person is live or not but does there is a more simple way ?
Once i know the id of the person can i use it directly ? Or the id might change ?

The ID never changes

With helix you can

https://api.twitch.tv/helix/streams?user_login=username

Theres no need to get the UserID first. But if the only thing you store is the username, when/if the username changes your code will break.

So when a user signs up, get and store their ID in a DB and use that all the time

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