code: private String generateState(String credentialToken) {
          JSONObject json = new JSONObject();
          try {
              json.put("credentialToken", credentialToken);
              json.put("loginStyle", "popup");
          } catch(Exception e) {
              log.warn(e.getMessage());
          }
          if (BuildConfig.DEBUG) {
              log.debug(json.toString());
          }
          return Base64.encodeToString(json.toString().getBytes(), Base64.URL_SAFE|Base64.NO_WRAP|Base64.NO_PADDING);
      }
docs: /*
  generates state and converts to base64 for sending to server