本文介绍了使用Postman发送Gmail时出现Application/Json错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Postman发送Gmail,但出现此错误:

这些是我配置的标题:

我已经配置了Google Cloud引擎所需的所有内容(Oauth权限,证书等),阅读了类似的文章,还尝试从gmail API游乐场进行测试,一切正常:

有什么问题的想法吗?

解决方案

删除所有自定义标头,(按照以下步骤创建新请求)

步骤:

    1. 点击下载的文件为json,然后保存身份验证

    2. 打开邮递员,然后从授权标头中将授权设置为0auth2.0:

    3. 通过根据下载的json填充内容来生成新令牌(打开json并按照json中的说明填写邮递员)

    将范围和状态设置为:

    I'm trying to send a Gmail with Postman but got this error:

    These are my configured headers:

    I have configured everything needed on Google Cloud engine (Oauth permissions, certifications...etc), read similar posts, and also tried testing from gmail API playground and everything was ok:

    Any idea of what could be wrong?

    解决方案

    Remove all custome headers , (Create a new request by following below steps)

    Steps:

    1. https://console.developers.google.com/ Goto url and create an API. (by clicking credentials>create credentials)

    2. https://console.developers.google.com/apis/api/gmail.googleapis.com/overview Goto url, click credentials> create new 0auth0.2 ( select applicaiton type as Web application)

    3. While creating 0auth0.2 scroll down and set Authorized redirect URIs as https://localhost

    1. CLick the download as json and then save the auth

    2. Open postman and set authorization as 0auth2.0 from authorization header:

    3. Generate new token by filling the content as per the downloaded json ( open the json and fill postman as in json)

    set scope and state as : https://mail.google.com/ ( full access ) see scope at : https://developers.google.com/gmail/api/auth/scopes

    1. In postman Set url as :https://gmail.googleapis.com/gmail/v1/users/praveendvd0pravu%40gmail.com/messages/send?key={YOURAPI_KEY_That_was_generated}

    2. goto https://www.base64encode.org/ , and paste below content and click encode. Copy the output.

      From: [email protected]: [email protected]: Hi

      Hi this is

    9): paste it as json body

    {
    
    "raw":"IEZyb206IHlvdXJlbWFpbEBnbWFpbC5jb20KIFRvOiB0b3NvbWVlbWFpbEBnbWFpbC5jb20KIFN1YmplY3Q6IEhpICAKICAgIApIaSB0aGlzIGlzIA=="
    
    }
    
    1. Send it :

    这篇关于使用Postman发送Gmail时出现Application/Json错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 20:01