ドメインの Google Classroom に接続する PHP でアプリを作成しています。ただし、Google Classroom API で何かをしようとすると、次のエラーが発生します。
Message: Error calling GET https://www.googleapis.com/v1/courses?pageSize=100: (404) Not Found
これまでの私のコード:
$scopes = array(
'https://www.googleapis.com/auth/classroom.courses',
'https://www.googleapis.com/auth/classroom.courses.readonly',
'https://www.googleapis.com/auth/classroom.rosters',
'https://www.googleapis.com/auth/classroom.rosters.readonly'
);
$gServiceEmail = "random@developer.gserviceaccount.com";
$gServiceKey = file_get_contents("../path/to/cert.p12");
$client = new Google_Client();
$gAuth = new Google_Auth_AssertionCredentials(
$gServiceEmail,
$scopes,
$gServiceKey
);
$gAuth->sub = "user@mydomain.com";
$client->setAssertionCredentials($gAuth);
$service = new Google_Service_Classroom($client);
$results = $service->courses->listCourses();
サービス アカウントの Google 管理コンソールの API 設定でスコープを有効にし、開発者コンソールで API を有効にしました。どこが間違っていますか?