我發現scribe不會在訪問令牌中提取refresh_token
。scribe不支持oauth 2.0中的refresh_token對嗎?
要OAuth 1.0提取包含:
Preconditions.checkEmptyString(response, "Response body is incorrect. Can't extract a token from an empty string");
String token = extract(response, TOKEN_REGEX);
String secret = extract(response, SECRET_REGEX);
return new Token(token, secret, response);
其中包含令牌密鑰。
但是在OAuth2.0中,沒有令牌密鑰,而是代替refresh_token
。抄寫員根本忽略它:
Preconditions.checkEmptyString(response, "Cannot extract a token from a null or empty String");
Matcher matcher = accessTokenPattern.matcher(response);
if(matcher.find())
{
return new Token(matcher.group(1), "", response);
}
else
{
throw new OAuthException("Cannot extract an acces token. Response was: " + response);
}
這會導致問題。訪問令牌將來可能會過期。我必須在每個登錄頁面中通過保存的刷新令牌來刷新訪問令牌,但是無法直接獲取它。
我打算改進抄寫員添加此功能(這並不難)......但是有沒有人已經這樣做?
您還需要通過CLIENT_ID和client_secret ......請注意,如果抄寫沒有做的OAuth2,我d只需使用oauth-signpost :-) – ejain 2013-04-05 20:23:16
這個路標? https://github.com/mttkay/signpost最後一次提交來自一年多前,它仍然不能用於LinkedIn api。祝你好運。 – 2013-04-06 15:44:59