Error 401 : OAuth token is missing

Hi,

I use powershell to communicate with the Twitch API. Since the update of May 1, 2020, I can no longer communicate with the API.

I modified my code according to the documentation ( Requiring OAuth for Helix Twitch API Endpoints) but I get this error message :

Error 401 : OAuth token is missing

Modified source code :

$headers = New-Object “System.Collections.Generic.Dictionary[[String],[String]]”
$headers.Add(“Authorization”, 'Bearer ’ + $Global:ConfigFile.Settings.ClientSecret)
$headers.Add(“Client-ID”, $Global:ConfigFile.Settings.ClientId)
$userAgent = $Global:ConfigFile.Settings.UserAgent
$Uri = “https://api.twitch.tv/helix/streams?user_login=[ChannelName]

$apiResult = Invoke-RestMethod -Uri $Uri -Method Get -UserAgent $userAgent -Headers $headers

Thank you in advance for the help you will give me.

This is wrong, you are sending your client secret as an oAuth, these are two separate things

You use your ClientID + ClientSecret to generate a token and you use that token.

You probably want the App Access Token flow to generate a server to server token

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