Matcher matcher = this.accessTokenPattern.matcher(response);
if (matcher.find() && matcher.groupCount() > 0) {
final String accessToken = matcher.group(1);
matcher = this.orcidTokenPattern.matcher(response);
if (matcher.find() && matcher.groupCount() > 0) {
return new OrcidToken(accessToken, "", matcher.group(1), response);
} else {
throw new OAuthException("Cannot extract orcid. Response was: " + response);
}
} else {
throw new OAuthException("Cannot extract an access token. Response was: " + response);