private int retrieveToken(String code, String oauthCodeSecret) {
		logger.debug("trying to retrieve token with the code: " + code + ", oauthCodeSecret: " + oauthCodeSecret);

		String redirect_uri = Constants.FBR_DASHBOARD_URI;

		HttpClient client = new DefaultHttpClient();
		HttpPost post = new HttpPost(Constants.FB_ACCESS_TOKEN_URI);

		try {

			String[][] parameters = { { "client_id", Constants.CLIENT_APP_ID }, { "client_secret", Constants.APP_SECRET }, { "redirect_uri", redirect_uri },
					{ "code", code } };

			List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(5);

			for (int i = 0; i < parameters.length; i++) {
				nameValuePairs.add(new BasicNameValuePair(parameters[i][0], parameters[i][1]));
			}

			post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

			HttpResponse resp = client.execute(post);

			logger.debug("resp received: " + resp);

			BufferedReader rd = new BufferedReader(new InputStreamReader(resp.getEntity().getContent()));

			String message = "";
			String lineData;
			while ((lineData = rd.readLine()) != null) {
				message += lineData;
			}

			logger.debug("message received: " + message);

			String token = null;

			// Add more safety traps
			String[] params = message.split("&");
			if (params != null) {
				for (int i = 0; i < params.length; i++) {
					if (params[i].contains("access_token")) {
						String[] B = params[i].split("=");
						if (B != null) {
							token = B[1];
						}
						break;
					}
				}
			} else {
				// Let the user know about the error.
				return 0;
			}

			logger.debug("token received: " + token);

			accessToken = token;

			return 1;

		} catch (Exception e) {
			return 0;
		}

	}