I found that scribe does not extract refresh_token
in access token.
The OAuth 1.0 extractor contains:
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);
Which contains token secret.
But in OAuth2.0, there is no token secret, but refresh_token
instead. Scribe simply ignores it:
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);
}
This causes a problem. The access token may expire in the future. I have to refresh access token by saved refresh token in every login pregress, but there is no way to get it directly.
I planned to improve scribe add this feature (it's not difficult)... but has anyone already done this ?