Skip to content

Commit

Permalink
add fb app security id (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
shunj-nb authored Oct 18, 2024
1 parent 75c5521 commit 8b0cecb
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions adapters/audienceNetwork/facebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ type facebookAdMarkup struct {
}

type facebookReqExt struct {
PlatformID string `json:"platformid"`
AuthID string `json:"authentication_id"`
PlatformID string `json:"platformid"`
AuthID string `json:"authentication_id"`
SecurityAppID string `json:"security_app_id,omitempty"`
}

type ExtImpFB struct {
AppSecret string `json:"app_secret"`
PlatformID string `json:"platform_id"`
AppSecret string `json:"app_secret"`
PlatformID string `json:"platform_id"`
SecurityAppID string `json:"security_app_id"`
}

func (this *FacebookAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
Expand Down Expand Up @@ -146,21 +148,24 @@ func (this *FacebookAdapter) modifyRequest(out *openrtb2.BidRequest) error {

platformId := this.platformID
appSecret := this.appSecret
securityAppId := ""

var bidderExt adapters.ExtImpBidder
err = json.Unmarshal(imp.Ext, &bidderExt)
if err == nil {
var impressionExt ExtImpFB
err = json.Unmarshal(bidderExt.Bidder, &impressionExt)
if err == nil && len(impressionExt.PlatformID) > 0 && len(impressionExt.AppSecret) > 0 {
if err == nil && len(impressionExt.PlatformID) > 0 && len(impressionExt.AppSecret) > 0 && len(impressionExt.SecurityAppID) > 0 {
platformId = impressionExt.PlatformID
appSecret = impressionExt.AppSecret
securityAppId = impressionExt.SecurityAppID
}
}

reqExt := facebookReqExt{
PlatformID: platformId,
AuthID: this.makeAuthID(out, appSecret),
PlatformID: platformId,
AuthID: this.makeAuthID(out, appSecret),
SecurityAppID: securityAppId,
}

if out.Ext, err = json.Marshal(reqExt); err != nil {
Expand Down

0 comments on commit 8b0cecb

Please sign in to comment.