不完整的 Linkedin OAuth 2.0 访问令牌响应
Incomplete Linkedin OAuth 2.0 access token response
我的问题是关于来自 Linkedin api 的 OAuth2 访问令牌响应。当我尝试获取此令牌时,我收到以下响应:
{"access_token":"...","expires_in":...}
但问题是,根据 OAuth2 documentation(在 5.1 段中)应该至少还有一个必需的参数 - “token_type”。
所以问题是:它是否可以以某种方式定制,以便 linkedin API 将 return 此参数与访问令牌响应,或者它只是偏离规则并且此参数不会 returned?
提前致谢。
我 运行 遇到了同样的问题。根据LinkedIn Docs:
A successful Access Token request will return a JSON object containing the following fields:
- access_token — The access token for the user. This value must be kept secure, as per your agreement to the API Terms of Use.
- expires_in — The number of seconds remaining, from the time it was requested, before the token will expire. Currently, all access tokens are issued with a 60 day lifespan.
他们回应
{"access_token":"...","expires_in":...}
违反了标准。
目前我正在使用 Spring Security 5.0.3 并且为了解决这个问题,我不得不对一个 class:
com.nimbusds.oauth2.sdk.token.BearerAccessToken
我不会post全部class,只会显着的一部分:
public static BearerAccessToken parse(final JSONObject jsonObject)
throws ParseException {
// Parse and verify type
AccessTokenType tokenType;
try {
tokenType = new AccessTokenType(JSONObjectUtils.getString(jsonObject, "token_type"));
} catch (ParseException ex) {
tokenType = AccessTokenType.BEARER;
}
if (!tokenType.equals(AccessTokenType.BEARER))
throw new ParseException("Token type must be \"Bearer\"");
//...
}
我希望从 Linkedin 会员那里得到答案,因为他们在他们的网站上声明 Whosebug 是提出此类问题的合适场所。但是由于他们没有回答,我也没有找到关于这个问题的任何相关信息,我相信这只是他们实现 OAuth 2.0 协议的方式。
我的问题是关于来自 Linkedin api 的 OAuth2 访问令牌响应。当我尝试获取此令牌时,我收到以下响应:
{"access_token":"...","expires_in":...}
但问题是,根据 OAuth2 documentation(在 5.1 段中)应该至少还有一个必需的参数 - “token_type”。 所以问题是:它是否可以以某种方式定制,以便 linkedin API 将 return 此参数与访问令牌响应,或者它只是偏离规则并且此参数不会 returned?
提前致谢。
我 运行 遇到了同样的问题。根据LinkedIn Docs:
A successful Access Token request will return a JSON object containing the following fields:
- access_token — The access token for the user. This value must be kept secure, as per your agreement to the API Terms of Use.
- expires_in — The number of seconds remaining, from the time it was requested, before the token will expire. Currently, all access tokens are issued with a 60 day lifespan.
他们回应
{"access_token":"...","expires_in":...}
违反了标准。
目前我正在使用 Spring Security 5.0.3 并且为了解决这个问题,我不得不对一个 class:
com.nimbusds.oauth2.sdk.token.BearerAccessToken
我不会post全部class,只会显着的一部分:
public static BearerAccessToken parse(final JSONObject jsonObject)
throws ParseException {
// Parse and verify type
AccessTokenType tokenType;
try {
tokenType = new AccessTokenType(JSONObjectUtils.getString(jsonObject, "token_type"));
} catch (ParseException ex) {
tokenType = AccessTokenType.BEARER;
}
if (!tokenType.equals(AccessTokenType.BEARER))
throw new ParseException("Token type must be \"Bearer\"");
//...
}
我希望从 Linkedin 会员那里得到答案,因为他们在他们的网站上声明 Whosebug 是提出此类问题的合适场所。但是由于他们没有回答,我也没有找到关于这个问题的任何相关信息,我相信这只是他们实现 OAuth 2.0 协议的方式。