This is how I used Scribe to authenticate with the Facebook Graph API in Struts 1.

The first half of the action redirects the client to Facebook, and basically says, "no code? come back when you have one buddy". Then it goes to Facebook, who redirects the client back here (back to Facebook.redirect_uri), and with the code the server contacts Facebook directly and gets an auth token.

Using that, it tries to go to and get a JSON object of the user's data. It only wants/keeps the facebook ID.

import org.apache.struts.action.*;
import org.scribe.builder.*;
import org.scribe.builder.api.*;
import org.scribe.model.*;
import org.scribe.oauth.*;

public class Authenticate extends Action {

  public ActionForward execute(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    OAuthService service = new ServiceBuilder()
                               .callback(Facebook.redirect_uri)   //should be the full URL to this action

    String verifierCode = request.getParameter("code");
    if(verifierCode == null) {
      String authURL = service.getAuthorizationUrl(null);
      return new ActionForward(authURL, true);
    else {
      Token accessToken = service.getAccessToken((Token)null, new Verifier(verifierCode));

      OAuthRequest authRequest = new OAuthRequest(Verb.GET, "");
      service.signRequest(accessToken, authRequest);
      Response authResponse = authRequest.send();

      JsonParser parser = new JsonParser();
      JsonObject authData = parser.parse(authResponse.getBody()).getAsJsonObject();

      return mapping.findForward(...);