Clore Nora
Clore Nora

Reputation: 137

Post a new description of my youtube channel with googleapis in Javascript

I'm trying to update my description with googleapis and axios. To do that, i'm following this tutorial https://developers.google.com/youtube/v3/docs/channels/update?apix=true&apix_params=%7B%22part%22%3A%5B%22brandingSettings%22%5D%2C%22resource%22%3A%7B%22brandingSettings%22%3A%7B%22channel%22%3A%7B%22description%22%3A%22hello%22%7D%7D%2C%22id%22%3A%22UCOsRlnWZakckW_5xYYkPd4Q%22%7D%7D

My code is

axios.post("https://youtube.googleapis.com/youtube/v3/channels", {
      headers: {
        'Authorization': 'Bearer ' + access_token,
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      data: {
          'id': "UCOsRlnWZakckW_5xYYkPd4Q",
          'brandingSettings': {
            'channel': {
              'description': "This is a short description.",
            }
        }
      },
      compressed: {}
    })

But when i'm launching this, i have an 404 error enter image description here

I already test with "put" but it's not working. Anyone have a clue about my problem ? thanks

Upvotes: 1

Views: 62

Answers (1)

Ketan Ramteke
Ketan Ramteke

Reputation: 10675

If you are using express then follow this:

Install cors

npm i cors --save

Use it in node server index.js

const cors = require('cors');

app.use(cors());

Upvotes: 2

Related Questions