# Change title and description

**URL:** <https://staging-discuss.dev.twitch.com/t/change-title-and-description/30891>\
**Category:** API\
**Created:** [March 19, 2021, 11:26am UTC](https://staging-discuss.dev.twitch.com/t/change-title-and-description/30891 "2021-03-19T11:26:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedepalu2](https://avatars.discourse-cdn.com/v4/letter/f/6f9a4e/32.png) [@fedepalu2](https://staging-discuss.dev.twitch.com/u/fedepalu2)\
**Post date:** [March 19, 2021, 11:26am UTC](https://staging-discuss.dev.twitch.com/t/change-title-and-description/30891/1 "2021-03-19T11:26:04Z")

</div>

Hi, I have a php script and I’m trying to change title in the broadcast

I get the token with this:

**$data = array(‘client\_id’ =\> $client\_id, ‘client\_secret’ =\> $client\_secret, ‘grant\_type’ =\> ‘client\_credentials’, ‘scope’ =\> ‘channel:manage:broadcast user:edit:broadcast’);**

and this is the call:

**curl\_setopt($ch, CURLOPT\_URL, ‘[https://api.twitch.tv/helix/channels?broadcaster\_id=](https://api.twitch.tv/helix/channels?broadcaster_id=)’ . $user\_id);  
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);  
curl\_setopt($ch, CURLOPT\_CUSTOMREQUEST, ‘PATCH’);**

 

**curl\_setopt($ch, CURLOPT\_POSTFIELDS, “{“title”:“NEWS”, “broadcaster\_language”:“es”}”);  
curl\_setopt($ch, CURLOPT\_HTTPHEADER, array(  
'Client-ID: ’ . $client\_id,  
'Authorization: Bearer ’ . $token,  
));**

but i get:

_“error”:“Bad Request”,“status”:400,“message”:“request must contain at least 1 channel property for updating”_

What I need is to define the Title but also the “description”, please any advice will be good!  
thanks  
Federico

---

<div class="post-metadata">

**Author:** ![Marenthyu](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/marenthyu/32/530_2.png) [@Marenthyu](https://staging-discuss.dev.twitch.com/u/Marenthyu)\
**Post date:** [March 19, 2021, 11:37am UTC](https://staging-discuss.dev.twitch.com/t/change-title-and-description/30891/2 "2021-03-19T11:37:14Z")

</div>

You are trying to use an **App Access Token** , which is not linked to a user. You must use the **Implicit** or **Authorization Code** Flow, not Client Credentials.

I could write a longer paragraph, but I already have here:

> [@Authenticating with the Twitch API](https://staging-discuss.dev.twitch.com/t/authenticating-with-the-twitch-api/29237):
>
> Introduction So, you want to work with the Twitch API and you probably noticed that everything requires some sort of Authentication / Authorization to allow you to use it. This Post/Wiki aims to answer some FAQ about that procedure and help you along in your journey. If you are already working with the API and are just struggling with Errors, scroll down to the Troubleshooting section. If instead, you are new to the API entirely and want to learn more, just read on! How to OAuth If the Twitch…

Additionally, @Dkamps18 pointed out elsewhere that your call is missing a `Content-Type` header. It should be set to `application/json` for how you are sending the data. (That will be why it can’t find your parameters and complains about not having any parameters passed to the endpoint.)

---

<div class="post-metadata">

**Author:** ![fedepalu2](https://avatars.discourse-cdn.com/v4/letter/f/6f9a4e/32.png) [@fedepalu2](https://staging-discuss.dev.twitch.com/u/fedepalu2)\
**Post date:** [March 20, 2021, 9:20pm UTC](https://staging-discuss.dev.twitch.com/t/change-title-and-description/30891/3 "2021-03-20T21:20:22Z")

</div>

> [@Marenthyu](#):
>
> You must use the **Implicit** or **Authorization Code** Flow,

Ok Thanks, following your tips, now I have an URL that generate the code (token) with 2 scope

`https://id.twitch.tv/oauth2/authorize?client_id=[client_id]&response_type=code&scope=channel:manage:broadcast%20channel:manage:videos&redirect_uri=http://localhost`

I pass the token (code) in the curl:

```
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.twitch.tv/helix/channels?broadcaster_id=' . $user_id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');

$jsonData = array(	'title' => 'NEWS', 'broadcaster_language' => 'es');

$jsonDataEncoded = json_encode($jsonData);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	'Client-ID: ' . $client_id,
	'Authorization: Bearer ' . $token,
	'Content-Type: application/json'
	));

$result = curl_exec($ch);

```

but I have an **“Unauthorized”,“status”:401,“message”:“Invalid OAuth token”**

thanks for any help!  
Federico

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [March 20, 2021, 9:25pm UTC](https://staging-discuss.dev.twitch.com/t/change-title-and-description/30891/4 "2021-03-20T21:25:12Z")

</div>

> [@fedepalu2](#):
>
> but I have an **“Unauthorized”,“status”:401,“message”:“Invalid OAuth token”**

The `code` is not a token

See Step 3

> **[Getting OAuth Access Tokens](https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/)**
>
> Getting OAuth Access Tokens

```auto
In our example, your user gets redirected to:

http://localhost/?code=394a8bc98028f39660e53025de824134fb46313
    &scope=viewing_activity_read
    &state=c3ab8aa609ea11e793ae92361f002671
3) On your server, get an access token by making this request:

POST https://id.twitch.tv/oauth2/token
    ?client_id=<your client ID>
    &client_secret=<your client secret>
    &code=<authorization code received above>
    &grant_type=authorization_code
    &redirect_uri=<your registered redirect URI>

```

or for PHP example:

> <https://github.com/BarryCarlyon/twitch_misc/blob/main/authentication/user_access_generator/php/index.php#L32>

---

<div class="post-metadata">

**Author:** ![fedepalu2](https://avatars.discourse-cdn.com/v4/letter/f/6f9a4e/32.png) [@fedepalu2](https://staging-discuss.dev.twitch.com/u/fedepalu2)\
**Post date:** [March 20, 2021, 10:37pm UTC](https://staging-discuss.dev.twitch.com/t/change-title-and-description/30891/5 "2021-03-20T22:37:47Z")

</div>

> [@BarryCarlyon](#):
>
> ```auto
> if (isset($_GET['code']) && $_GET['code']) {
> // we have a code on the address line so lets parse and exchange
> 
> // validate the state/nonce
> if (isset($_SESSION['nonce']) && isset($_GET['state']) && $_SESSION['nonce'] == $_GET['state']) {
> // lets exchange the code for an access token
> $ch = curl_init('https://id.twitch.tv/oauth2/token');
> curl_setopt($ch, CURLOPT_POST, true);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($ch, CURLOPT_POSTFIELDS, array(
> 'client_id' => CLIENT_ID,
> 
> ```

OK THANKS!!! PERFECT!  
Seems is not possible to change the “live notification” via api…

> **[Live notification](https://twitch.uservoice.com/forums/310213-developers/suggestions/39703660-live-notification)**
>
> Kraken allows you to set Game and Title.
> 
> Helix allows you to set nothing.
> 
> Aside from updating Helix to allow setting game and title, we'd like to be able to set the "Go Live Notification"

Bye

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [April 19, 2021, 10:37pm UTC](https://staging-discuss.dev.twitch.com/t/change-title-and-description/30891/6 "2021-04-19T22:37:51Z")

</div>

Closed on April 19, 2021, 10:37pm UTC

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