title: Why does creating a course on the Google Classroom API doesn't work?
body: <p>I'm new to Google APIs and a noob at node.JS.
  I can't figure out creating a course doesn't work.</p>
  <p>The script for creating a course is a modified version of the apps script example available on the Google Developer website.</p>
  <p>Help is highly appriciated as I am a young student trying to make my own e-learning platform based off Google Classroom and other aleardy made solutions.</p>
  <p>Am I missing something?</p>
  <pre><code>const readline = require('readline');
  const {google} = require('googleapis');
  const chalk = require('chalk');
  
  const SCOPES = ['https://www.googleapis.com/auth/classroom.courses', 
  const TOKEN_PATH = 'token.json';
  
  fs.readFile('credentials.json', (err, content) =&gt; {
    if (err) return console.log('Error loading client secret file:', err);
    // Authorize a client with credentials, then call the Google Classroom API.
    authorize(JSON.parse(content), listCourses, createCourse);
  });
  
  function authorize(credentials, callback) {
    const {client_secret, client_id, redirect_uris} = credentials.installed;
    const oAuth2Client = new google.auth.OAuth2(
        client_id, client_secret, redirect_uris[0]);
  
    fs.readFile(TOKEN_PATH, (err, token) =&gt; {
      if (err) return getNewToken(oAuth2Client, callback);
      oAuth2Client.setCredentials(JSON.parse(token));
      callback(oAuth2Client);
    });
  }
  
  function getNewToken(oAuth2Client, callback) {
    const authUrl = oAuth2Client.generateAuthUrl({
      access_type: 'offline',
      scope: SCOPES,
    });
    console.log('Authorize this app by visiting this url:', authUrl);
    const rl = readline.createInterface({
      input: process.stdin,
      output: process.stdout,
    });
    rl.question('Enter the code from that page here: ', (code) =&gt; {
      rl.close();
      oAuth2Client.getToken(code, (err, token) =&gt; {
        if (err) return console.error('Error retrieving access token', err);
        oAuth2Client.setCredentials(token);
        // Store the token to disk for later program executions
        fs.writeFile(TOKEN_PATH, JSON.stringify(token), (err) =&gt; {
          if (err) return console.error(err);
          console.log('Token stored to', TOKEN_PATH);
        });
        callback(oAuth2Client);
      });
    });
  }
  
  function listCourses(auth) {
    const classroom = google.classroom({version: 'v1', auth});
    classroom.courses.list({
      pageSize: 1234,
    }, (err, res) =&gt; {
      if (err) return console.error(chalk.red('[ERROR] ') + err);
      const courses = res.data.courses;
      if (courses &amp;&amp; courses.length) {
        console.log('Courses:');
        courses.forEach((course) =&gt; {
          console.log(`${course.name} (${course.id})`);
        });
      } else {
        console.log('No courses found.');
      }
    });
  }
  
  function createCourse(auth) {
    const classroom = google.classroom({version: 'v1', auth});
    classroom.courses.create({
      name: 'somethin!',
      section: 'Period 2',
      descriptionHeading: 'somethin',
      description: &quot;somethin&quot;,
      room: '301',
      ownerId: 'me',
      courseState: 'PROVISIONED',
    }, (err, res) =&gt; {
      if (err) return console.error(chalk.red('[ERROR] ') + err);
    });
  }```
  </code></pre>