* @see com.google.code.facebook.graph.client.oauth.FacebookOAuthService#getAccessToken(java.lang.String, java.lang.String)
*/
@Override
public String getAccessToken(String callBackUrl, String code) {
try {
GitHubApiUrlBuilder builder = createGitHubApiUrlBuilder(GitHubApiUrls.OAuthUrls.ACCESS_TOKEN_URL);
builder.withParameter(ParameterNames.CLIENT_ID, clientId);
builder.withParameter(ParameterNames.CLIENT_SECRET, secret);
builder.withParameter(ParameterNames.REDIRECT_URI, callBackUrl);
builder.withParameter(ParameterNames.CODE, code);
String response = convertStreamToString(callApiGet(builder.buildUrl()));
Matcher matcher = ApplicationConstants.ACCESS_TOKEN_PATTERN.matcher(response);
if (matcher.find()) {
return matcher.group(1);
} else {
throw new GitHubException(response);