@Override
  public String getAuthenticationUrl(String account, String service,
    String redirectUrl, Map<String, String> authExtra) {

    Map<String, String> qparams = new LinkedHashMap<String, String>();
    qparams.put("client_id", clientId);
    qparams.put("redirect_uri", redirectUrl);
    qparams.put("service", service);

    // send access token if we have one
    if (StringUtils.isNotBlank(account)) {
      String accessToken = accountStorage.getAccessToken(account);
      if (StringUtils.isNotBlank(accessToken)) {
        qparams.put("access_token", accessToken);
      }
    }

    // add in scope and flag parameters if present
    if (authExtra != null) {
      if (authExtra.containsKey("scope")) {
        qparams.put("scope", authExtra.get("scope"));
      }
      if (authExtra.containsKey("flag")) {
        qparams.put("flag", authExtra.get("flag"));
      }
    }

    // create the authentication url
    return SinglyUtils.createSinglyURL("/oauth/authenticate", qparams);
  }