有许多关于此主题的文章,但仍然没有确切的解决方法来解决此问题。
即使在下面的Google API链接中,也有一个测试API的选项 https://developers.google.com/gmail/api/v1/reference/users/watch
这个API会抛出一个错误,如无效的主题名称不匹配
,但我已经在pub sub中创建了主题,并且已经发布了消息到它上面,那个主题运行得很好,但是我仍然收到以下错误。我收到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." }}