【问题标题】:Google Email Api Modify lableGoogle 电子邮件 API 修改标签
【发布时间】:2018-10-19 11:04:03
【问题描述】:

尝试修改标签。

我的代码:

service.Users.Messages.Modify(mods, userId, messageId).Execute();

错误信息:

服务 gmail 已抛出异常:Google.GoogleApiException: Google.Apis.Requests.RequestError 权限不足 [403] 错误 [ Message[Insufficient Permissions] Location[-] Reason[insufficientPermissions] Domain[global] ]

在 Google.Apis.Requests.ClientServiceRequest1.Execute() in C:\Apiary\v1.25\Src\Support\GoogleApis\Apis\Requests\ClientServiceRequest.cs:line 101 at CreditRecon.DownloadAttachment.ModifyMessage(GmailService service, String userId, String messageId, List1

【问题讨论】:

    标签: c# google-api google-oauth gmail-api google-api-dotnet-client


    【解决方案1】:

    为了更新用户的消息,您需要获得用户的许可。

    权限不足

    表示您没有经过身份验证的用户修改他们的消息的权限。

    重新验证您的用户并确保您已向他们请求以下权限范围之一

    https://mail.google.com/
    https://www.googleapis.com/auth/gmail.modify

    更新重新验证用户:

    要重置身份验证,请将“shankitagrawal@ltfs.com”更改为其他内容。或进入您的 credPath 并删除以该文件为名称的文件。它将提示您再次进行身份验证。

    【讨论】:

    • 如何重新认证用户。我正在使用这个developers.google.com/gmail/api/v1/reference/users/messages/…
    • 检查您的身份验证代码,您应该有类似“用户”的更改。如果您不明白,请编辑您的问题并添加您的验证码。
    • GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, { GmailService.Scope.GmailLabels,GmailService.Scope.MailGoogleCom }, "shankitagrawal@ltfs.com", CancellationToken.None, new FileDataStore( credPath, true)).Result;
    • 安全性较低的应用需要获得权限。
    • @ShankitAgrawal 检查我的更新应该可以帮助您重新验证
    猜你喜欢
    • 2014-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-03
    • 2023-03-04
    • 2017-06-13
    相关资源
    最近更新 更多