java - 在java中没有得到JSON响应

标签 java oauth-2.0

我认为问题出在访问 protected 资源的配置设置中,但我在这里可能是错的。 我已经尝试过使用 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 响应。 我收到以下回复

“文本/html;字符集=UTF-8”

这给了我以下错误..

"Cannot handle text/html; charset=UTF-8 content type. Supported content types include JSON, XML and URLEncoded"

提前致谢。

最佳答案

您需要发送请求 header 接受:application/json

关于java - 在java中没有得到JSON响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42106732/

相关文章:

google-cloud-platform - 项目中没有使用过API或者被禁用403错误

java - 带有自定义安全过滤器的 Spring Boot OAuth2

javascript - 如何使用泛型在 TypeScript 中模拟 Java getClass()?

java - 如何使用applet、awt和swing在java中制作动画应用程序?

java - 使用盐散列密码

reactjs - 我应该如何在我的案例中使用 OAuth 2.0 授权授权(React 前端,Spring Boot 后端)

java - 无法在 struts2 中获取 JSON Url 参数

javac 忽略@SuppressWarnings ("all")

oauth - Outlook Office 365 : Refresh token failed to retrieve because "AADSTS70000" the provided value for the 'code' parameter is not valid

android - 带有应用链接的 OAuth 重定向偶尔不起作用