在课堂上创建课程:请求的认证范围不足

时间:2018-03-07 06:38:15

标签: android google-classroom

在Google教室api中创建课程时遇到问题:

while (reader.Read())
{
    Console.WriteLine("\t{0}\t{1}", reader["ColumnOneName"].ToString(),
    reader["ColumnTwoName"].ToString());
}

我的代码:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "angular5"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    },
    {
      "platform": "server",
      "root": "src",

      "outDir": "dist/server",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.server.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.server.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

我不知道应该给ownerid的名称,这段代码是否正确。

1 个答案:

答案 0 :(得分:1)

您没有显示可能导致问题的代码。您似乎正在使用需要此范围的courses.create

  

授权范围需要以下OAuth范围:

https://www.googleapis.com/auth/classroom.courses

但你正在使用:

https://www.googleapis.com/auth/classroom.courses.readonly

此外,如果您要更改范围,请删除以前保存的凭据。