调用方没有关于 PubSub 注册的 403 权限

问题描述

使用服务帐号。使用正确的范围(在本例中为 https://www.googleapis.com/auth/classroom.courses.readonlyhttps://www.googleapis.com/auth/classroom.push-notifications)设置了域范围的委派。

我可以查看整个项目的课程。但是

                var newReg = classroomService.Registrations.Create(theReg);

失败

Google.GoogleApiException: 'Google.Apis.Requests.RequestError The caller does not have permission [403] Errors [ Message[The caller does not have permission] Location[ - ] Reason[forbidden] Domain[global]

这是信用代码(我认为这是问题所在)。 . .

var serviceAccountCred = new ServiceAccountCredential(
                new ServiceAccountCredential.Initializer(serviceAccountCreds.ClientEmail)
                {
                    User = theAgencyAccount.Admin,Scopes = theScopes,}.FromPrivateKey(serviceAccountCreds.PrivateKey));

        // Create the service.
        var classroomService = new ClassroomService(new BaseClientService.Initializer()
        {
            HttpClientinitializer = serviceAccountCred,ApplicationName = appName,});

我已经无能为力了。 . .

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)