There are many post on this same topic but still there is no exact solution to solve this issue.
even in the google API below link, there is a option to test the API https://developers.google.com/gmail/api/v1/reference/users/watch
This API throws a error like Invalid Topic Name does not match but I have created the topic in the pub sub and I have published the message on it, that topic works fine but then also I am receiving below error. I am receiving 400 error
{ "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/*" }}
I have tried to call this API in client side, like below
gapi.client.gmail.users.watch({
'userId': 'me',
"topicName": "projects/fast-metric-178608/topics/Test"
}).then(function (response) {
console.log(response)
});
Below is output , i am receiving 403 error
{ "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." }}