我想通过Google Cloud Pub/Sub API接收新的Gmail通知 [英] I want to get new Gmail notify by Google Cloud Pub/Sub API

查看:49
本文介绍了我想通过Google Cloud Pub/Sub API接收新的Gmail通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在googleapis上经历了非常糟糕的经历,失去了一个星期,但是失败了,所以我提出了一些问题以寻求大家的帮助.

创建主题后&从Google Cloud Flatform Console的PUB/SUB订阅(带有端点URL),我使用了代号为bellow的nodejs:

var gmail = google.gmail({ auth: {---my auth---}, version: 'v1' });

gmail.users.watch({
    userId: "me",
    resource: {
        topicName: "projects/responsive-hall-xxxx/topics/xxxx",
        labelIds: ["INBOX"]
    }
}

但是出现错误403:

{ 
       domain: 'global',
       reason: 'forbidden',
       message: 'Error sending test message to Cloud PubSub projects/responsive-hall-xxxx/topics/xxxx : User not authorized to perform this action.'
}

我尝试为我的pub/sub上的gmail帐户设置权限,但仍然没有成功.

请帮助, 谢谢!

解决方案

是否已授予您对主题serviceAccount:gmail-api-push@system.gserviceaccount.com的发布权限,如

But got the error 403:

{ 
       domain: 'global',
       reason: 'forbidden',
       message: 'Error sending test message to Cloud PubSub projects/responsive-hall-xxxx/topics/xxxx : User not authorized to perform this action.'
}

I tried to set permissions for my gmail account on the pub/sub but still unsuccess.

Please help, Thanks!

解决方案

Have you granted publish permission to serviceAccount:gmail-api-push@system.gserviceaccount.com for your topic as given here?

这篇关于我想通过Google Cloud Pub/Sub API接收新的Gmail通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆