facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
393 stars 324 forks source link

The ct parameter isn’t hashed, error_subcode: 2804016 #421

Open piotrswiatowski-gyg opened 1 year ago

piotrswiatowski-gyg commented 1 year ago

Which SDK version are you using?

v16.0.1

What's the issue?

API send events request failed with message:

Upload failed for 26 of type ReviewResultsRequest: {"error":{"message":"Invalid parameter","type":"OAuthException","code":100,"error_subcode":2804016,"is_transient":false,"error_user_title":"User Parameter Not Hashed","error_user_msg":"The ct parameter isn\u2019t hashed. Hash all user parameters as SHA256, except for client user agent, click ID, and browser ID. Any other user parameters that are not hashed are automatically rejected by Facebook.","fbtrace_id":"..."}}

Steps/Sample code to reproduce the issue

    new UserData()
      .email(email.orNull)
      .fbp(facebookPixel.orNull)
      .fbc(facebookClick.orNull)
      .clientIpAddress(ipAddress.orNull)
      .externalId(externalId)
      .clientUserAgent(userAgent)
      .city(locationData.city.orNull)
      .state(locationData.state.orNull)
      .countryCode(locationData.countryCode.orNull)

and based on

  @SerializedName(ServerSideApiConstants.CITY)
  @JsonAdapter(Sha256StringListAdaptor.class)
  private List<String> cities = null;

it should be hashed.

Screenshot 2023-05-30 at 13 41 01