I'm developing a php application using Google Classroom, and keep getting a "code": 403, "message": "Request had insufficient authentication scopes." error.
Here's what I've done so far, any help would be tremendous!
I've set up my app oauth permissions to use auth/classroom.push-notifications
I've set '[email protected]' to have the Pub/Sub Publisher role
I've set up a Pub/Sub topic
Here's the code I'm using:
$google_course_id = '123456';
$topic_name = 'projects/my-app-name/topics/TopicName';
$feed_type = 'COURSE_WORK_CHANGES';
$user = User::find(2); // User who has authorized via OAuth and accepted all permissions
$client = new Google_Client();
$client->setAccessToken($user->get_google_social_token());
$classroom = new Google_Service_Classroom($client);
$pub_sub = new Google_Service_Classroom_CloudPubsubTopic();
$pub_sub->setTopicName($topic_name);
$work_changes_info = new Google_Service_Classroom_CourseWorkChangesInfo();
$work_changes_info->setCourseId($google_course_id);
$feed = new Google_Service_Classroom_Feed();
$feed->setCourseWorkChangesInfo($work_changes_info);
$feed->setFeedType($feed_type);
$registration = new Google_Service_Classroom_Registration();
$registration->setCloudPubsubTopic($pub_sub);
$registration->setFeed($feed);
$classroom->registrations->create($registration);
Unfortunately, I keep getting the 403 error.
Any help in identifying what I'm missing would be greatly appreciated!