private void webAuth() {

    AQUtility.debug("web auth");

    Bundle parameters = new Bundle();
    parameters.putString("client_id", appId);
    parameters.putString("type", "user_agent");
    if (permissions != null) {
      parameters.putString("scope", permissions);
    }

    parameters.putString("redirect_uri", REDIRECT_URI);
    String url = OAUTH_ENDPOINT + "?" + encodeUrl(parameters);

    FbWebViewClient client = new FbWebViewClient();

    dialog = new WebDialog(act, url, client);
    dialog.setLoadingMessage(message);
    dialog.setOnCancelListener(client);

    show();

    if (!first || token != null) {

      AQUtility.debug("auth hide");
      hide();
    }

    dialog.load();

    AQUtility.debug("auth started");
  }
 private void hide() {
   if (dialog != null) {
     try {
       dialog.hide();
     } catch (Exception e) {
       AQUtility.debug(e);
     }
   }
 }