throw new OauthClientException("Failed to create token. "+e.getMessage(), e);
}
}
private OauthToken toToken(OauthTokenDetail resp) {
OauthToken token = new OauthToken();
token.owner = this;
token.refreshToken = resp.refreshToken != null ? resp.refreshToken.token : null;
token.accessToken = resp.accessToken.token;
token.setAccount(resp.account);
token.scope = join(resp.accessToken.scopes,",");
token.tokenType = resp.accessToken.tokenType;
token.uid = resp.uid;
token.email = resp.email;
token.setExpiresIn(resp.accessToken.expiresIn);
token.id = resp.id;
return token;
}