API Request does not work anymore!

This is my Code:

 $gameName = htmlspecialchars($_POST['name1']);
 $channelsApi3 = 'https://api.twitch.tv/helix/games?name=';
 $clientId = 'iurtvzm8jby3aiqgq9lpqvnw29sp2b';
 $ch3 = curl_init();
 $apiVers3 = '&api_version=5';
 $uri3 = '&redirect_uri=https://smartsblog.optimal-options.de/';
 
 curl_setopt_array($ch3, array(
    CURLOPT_HTTPHEADER => array(
       'Client-ID: ' . $clientId
    ),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_URL => $channelsApi3 . urlencode($gameName) . $apiVers3 . $uri3
 ));

 $response3 = curl_exec($ch3);

Define does not work?

What is the response you are getting

You have no Authorization token/bearer here.

Are you getting a 4xx?

A token is required. You probably need to add to code to generate, store, load and reuse a App Access Token

OAuth token is missing

401

You need to use an oAuth token then

I do not now how to put get and though into php?

Here is a PHP example for generating an App Access Token

So after I’ve generated my Token how to insert it in my Code?


curl_setopt_array($ch3, array(
CURLOPT_HTTPHEADER => array(
'Client-ID: ’ . $clientId,
'Authorization: Bearer ' . $token
),

instead $token -> $keys or what?

$token is whatever the variable is that you put the token into after generating a token via the Client Credentials/App Access Token flow

Is that correct: $token[access_token];?

Depends on your code. I don’t know what your code looks like so I can’t tell you what your variables look took and thus what variables to use

It is of your Link: generate_and_maintain_token.php

How to obtain Token of the $keys variable, is the Question??

That I generates wroks yet!!

And I have no idea how you copy/pasted that into your code, without looking at your code.

Since generate_and_maintain_token.php does not have a $token, it just print_r's

But if you put $data at line 62 into a variable called $token then sure, that sounds correct

Done it still: {“error”:“Unauthorized”,“status”:401,“message”:“OAuth token is missing”}

Please show all your code with the secrets redacted.

Now I have just this error: Object of class stdClass could not be converted to string