How to format URLs correctly for Twitch Helix API requests

I’m trying to switch from the old Twitch API to the new Helix version but running into authentication issues. When I make requests to endpoints like getting user followers, I keep getting 401 unauthorized errors.

For example, when I try:

https://api.twitch.tv/helix/users/follows?from_id='streamer_id'

I get this response:

{
    "error": "Unauthorized",
    "status": 401,
    "message": "Must provide a valid Client-ID or OAuth token"
}

With the old Kraken API, I could just append my credentials to the URL like:

https://api.twitch.tv/kraken/streams/STREAMNAME?client_id=myClientId123&oauth_token=myToken456

This worked fine before. Now I’ve tried adding my client ID and token as URL parameters with the & symbol, but I still get the same unauthorized error. I also tried putting the auth parameters before the main query parameter but no luck.

What’s the proper way to structure URLs for the Helix API? Do I need to format the authentication differently?

yup, its diff now. gotta send Client-ID and Authorization in headers instead of URL. like: Client-ID: your_client_id and Authorization: Bearer your_token. works smooth that way!

The issue arises from Twitch’s shift away from URL-based authentication with the Helix API. Unlike the old Kraken API, which allowed credentials in URL parameters, Helix requires all authentication details in headers. You need to set two headers: Client-ID with your application’s client ID, and Authorization with your access token formatted as Bearer your_access_token. Additionally, keep your URL strictly to the endpoint and its query parameters, avoiding any authentication data within it. It’s worth noting that the followers endpoint you’re trying to access is also deprecated.

The issue is Twitch killed URL-based auth when they moved to Helix. You need to put your credentials in HTTP headers now - no more query parameters. Use Client-ID header for your app’s client ID and Authorization header for Bearer your_access_token. Keep your URL clean with just the endpoint and required params, no auth stuff. I went through this same transition six months ago and had to redo all my API calls for header auth. Oh, and that specific endpoint you’re hitting? It’s been discontinued, so you’ll need to find another way to get follower data.

Had the same issue when I migrated my bot last year. Helix completely changed how authentication works - you can’t just throw credentials in the URL anymore. Now you’ve got to put them in the headers instead. Use Client-ID for your app’s client ID and Authorization for Bearer your_access_token. Keep your URL clean with just the endpoint and query params. Oh, and heads up - they killed the followers endpoint back in August 2022 for privacy reasons, so you might need to find another way depending on what you’re building.

Just hit this same issue lol. Helix doesn’t accept auth params in the URL anymore - that’s old Kraken API stuff. You need to use headers now: Client-ID: your_client_id and Authorization: Bearer token_here. Also heads up, that follows endpoint got killed in 2022.