没有在java中获得JSON响应

时间:2017-02-08 07:05:12

标签: java oauth-2.0

我认为问题在于访问受保护资源的配置设置,但我可能在这里错了。 我曾尝试使用SalesForce和Gmail ..

以下是我尝试用于gmail的示例配置文件

#scope=
grant_type=password
username=chitXXXXal@gmail.com
password=sumXXX3
client_id=685531072783-qu8rcpnv05800u1i3g8g3302eap1u914.apps.googleusercontent.com
#client_secret=
#access_token=
#refresh_token=
authentication_server_url=https://mail.google.com
resource_server_url=https://mail.google.com

我是Oauth的新手,因此我无法理解如何获得JSON响应。 我收到了以下回复

“text / html; charset = UTF-8”

给了我以下错误..

  

“无法处理text / html; charset = UTF-8内容类型。支持   内容类型包括JSON,XML和URLEncoded“

提前致谢。

1 个答案:

答案 0 :(得分:1)

您需要发送请求标头Accept: application/json