【问题标题】:500 error.Internal[backend error] Google Api Push #gmail_watch500 错误。内部 [后端错误] Google Api Push #gmail_watch
【发布时间】:2018-05-21 22:03:11
【问题描述】:

我尝试使用此处的指南获取通知。 https://developers.google.com/gmail/api/guides/push#gmail_watch

Gmailservice(service) 可以获取标签、收件箱等api功能。

这里是代码。

        var service = new GmailService(new BaseClientService.Initializer()
    {
        HttpClientInitializer = credential,
        ApplicationName = ApplicationName,
    });
    IList<string> label = new List<string>();
    label.Add("INBOX");
    WatchRequest request2 = new WatchRequest
    {
        LabelIds = label,
        LabelFilterAction = "include",
        TopicName = "projects/******/topics/****TestTopic"
    };
    var x= service.Users.Watch(request2, "me").Execute();

手表抛出此异常

Google.Apis.Requests.RequestError
Backend Error [500]
Errors [
    Message[Backend Error] Location[ - ] Reason[backendError] Domain[global]
]

【问题讨论】:

    标签: .net gmail-api


    【解决方案1】:

    好的,我的解决了。 是的,我同意,来自 gmail API 的错误消息有些晦涩,但这是我修复它的方法。

    显然,我忘记向 gmail 授予 Push 权限。 为此,请转到 here 并执行以下操作:

    • 选择您的项目。
    • 在右侧的选项卡中,将推送权限授予gmail-api-push@system.gserviceaccount.com

    祝你好运!

    【讨论】:

    • 好吧,我之前确实给了编辑权限来服务帐户,我认为应该没问题。如果我做错了请纠正我
    • 不确定 Editor 权限赋予什么,但要排除它 - 您可以尝试授予 Publisher 权限,这对我有用。
    猜你喜欢
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多