0

I am building an app with Swift and Xcode. For it, I am using the Google Classroom API. When trying to turn in a homework assignment, I get this error : "@ProjectPermissionDenied The Developer Console project is not permitted to make this request."

Looking at other Stack Overflow posts, I saw that it was because the assignments were created by another Developer Console project and that I don't have access to turn them in. But, is there any way that I would be able to turn in the assignment?

This is the code in the App Delegate:

func turnInHomeworkAssignment(courseId: String, courseWorkId : String, studentSubmissionId : String, onCompleted : @escaping(Error?) -> ()) {
    if self.service.authorizer != nil {
        let turnInObject = GTLRClassroom_TurnInStudentSubmissionRequest.init()
        let turnInAssignment = GTLRClassroomQuery_CoursesCourseWorkStudentSubmissionsTurnIn.query(withObject: turnInObject, courseId: courseId, courseWorkId: courseWorkId, identifier: studentSubmissionId)

        self.service.executeQuery(turnInAssignment) { (ticket, results, error) in
            onCompleted(error)
        }
    }
}

And when a button to turn in an an assignment is pressed then it will call this code:

let appDelegate = UIApplication.shared.delegate as! AppDelegate
    appDelegate.turnInHomeworkAssignment(courseId: courseID, courseWorkId : courseWorkID, studentSubmissionId : studentSubmissionID) { (error) in
        if error != nil {
            print ("Error turning in Homework: \(String(describing: error?.localizedDescription))")
            return
        }

    }

Thank you very much, Rosalie

Rosalie W
  • 359
  • 4
  • 16
  • Yes, you're correct. `ProjectPermissionDenied` indicates that the request attempted to modify a resource associated with a different Developer Console project. Kindly check the solution offered from this [SO post](https://stackoverflow.com/questions/38313748/google-classroom-api-modifyattachments). – Jessica Rodriguez Feb 18 '19 at 12:29
  • What I ended up doing was making an add assignment screen in my app. You can add assignments to google classroom and then turn them in as long as they are created in your app. – Rosalie W Mar 20 '19 at 18:10

0 Answers0