There are many post on this same topic but still there is no exact solution to solve this issue.
即使在google API下面的链接中,也可以选择测试API https://developers.google.com/gmail/api/v1/reference/users/watch
这个API抛出了像Invalid Topic Name does not match
这样的错误,但我在pub子中创建了主题并且我已经在其上发布了该消息,该主题工作正常,但我也收到了以下错误。我收到400错误
{ "error": {"errors": [{
"domain": "global",
"reason": "invalidArgument",
"message": "Invalid topicName does not match projects/google.com:apisexplorerconsole/topics/*" } ],"code": 400,"message":"Invalid topicName does not match projects/google.com:apisexplorerconsole/topics/*" }}
我试图在客户端调用此API,如下所示
gapi.client.gmail.users.watch({
'userId': 'me',
"topicName": "projects/fast-metric-178608/topics/Test"
}).then(function (response) {
console.log(response)
});
下面输出,我收到403错误
{ "error": { "errors": [{
"domain": "global",
"reason": "forbidden",
"message": "Error sending test message to Cloud PubSub projects/fast-metric-178608/topics/Test : User not authorized to perform this action."} ],"code": 403, "message": "Error sending test message to Cloud PubSub projects/fast-metric-178608/topics/Test : User not authorized to perform this action." }}
答案 0 :(得分:0)
https://console.cloud.google.com/cloudpubsub/topicList
选择您的主题和 设置主题PERMISSIONS allUser并选择角色Pub / Sub Admin