Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

500 error.Internal[backend error] Google Api Push #gmail_watch

Tags:

.net

gmail-api

I tried to get notifications using the guide Here. https://developers.google.com/gmail/api/guides/push#gmail_watch

Gmailservice(service) is able to get Labels,Inbox and other api features.

Here is the code.

        var service = new GmailService(new BaseClientService.Initializer()
    {
        HttpClientInitializer = credential,
        ApplicationName = ApplicationName,
    });
    IList<string> label = new List<string>();
    label.Add("INBOX");
    WatchRequest request2 = new WatchRequest
    {
        LabelIds = label,
        LabelFilterAction = "include",
        TopicName = "projects/******/topics/****TestTopic"
    };
    var x= service.Users.Watch(request2, "me").Execute();

Watch Throws This Exception

Google.Apis.Requests.RequestError
Backend Error [500]
Errors [
    Message[Backend Error] Location[ - ] Reason[backendError] Domain[global]
]
like image 990
varun reddy Avatar asked Sep 06 '26 01:09

varun reddy


1 Answers

OK, mine is solved. Yes, I agree, the error message from gmail API is somewhat obscure, but here is how I have fixed it.

Apparently, I forgot to grant Push permissions to gmail. To do so go here and do the following:

  • Select your project.
  • From the tab on the right, grant push rights to [email protected].

Good Luck!

like image 140
Elior Malul Avatar answered Sep 08 '26 19:09

Elior Malul