Gmail API returns 403 error code and “Delegation denied for

前端 未结 5 1884
礼貌的吻别
礼貌的吻别 2020-11-29 04:58

Gmail API fails for one domain when retrieving messages with this error:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 OK
{
  \"code         


        
5条回答
  •  星月不相逢
    2020-11-29 06:03

    I wanted to access the emails of fresh email id/account but what happened was, the recently created folder with '.credentials' containing a JSON was associated with the previous email id/account which I tried earlier. The access token and other parameters present in JSON are not associated with new email id/account. So, in order make it run you just have to delete the '.credentails' folder and run the program again. Now, the program opens the browser and asks you to give permissions.

    To delete the folder containing files in python

    import shutil
    shutil.rmtree("path of the folder to be deleted")
    

    you may add this at the end of the program

提交回复
热议问题