Skip to content

Commit

Permalink
facebook: removed Auth-Token from header (replaced by authentication_…
Browse files Browse the repository at this point in the history
…id in the request body) (#1113)
  • Loading branch information
Aadeshp authored and mansinahar committed Dec 6, 2019
1 parent d64c98b commit 4bf82f6
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
"Accept": [
"application/json"
],
"Auth-Token": [
"test-app-id|test-app-secret"
],
"Content-Type": [
"application/json;charset=utf-8"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
"Accept": [
"application/json"
],
"Auth-Token": [
"test-app-id|test-app-secret"
],
"Content-Type": [
"application/json;charset=utf-8"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
"Accept": [
"application/json"
],
"Auth-Token": [
"test-app-id|test-app-secret"
],
"Content-Type": [
"application/json;charset=utf-8"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
"Accept": [
"application/json"
],
"Auth-Token": [
"test-app-id|test-app-secret"
],
"Content-Type": [
"application/json;charset=utf-8"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@
"Accept": [
"application/json"
],
"Auth-Token": [
"test-app-id|test-app-secret"
],
"Content-Type": [
"application/json;charset=utf-8"
],
Expand Down Expand Up @@ -142,9 +139,6 @@
"Accept": [
"application/json"
],
"Auth-Token": [
"test-app-id|test-app-secret"
],
"Content-Type": [
"application/json;charset=utf-8"
],
Expand Down
13 changes: 1 addition & 12 deletions adapters/audienceNetwork/facebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type FacebookAdapter struct {
URI string
nonSecureUri string
platformID string
appID string
appSecret string
}

Expand Down Expand Up @@ -75,7 +74,6 @@ func (this *FacebookAdapter) buildRequests(request *openrtb.BidRequest) ([]*adap

headers.Add("Content-Type", "application/json;charset=utf-8")
headers.Add("Accept", "application/json")
headers.Add("Auth-Token", this.appID+"|"+this.appSecret)
headers.Add("X-Fb-Pool-Routing-Token", request.User.BuyerUID)

for _, imp := range request.Imp {
Expand Down Expand Up @@ -406,7 +404,7 @@ func resolveImpType(imp *openrtb.Imp) (openrtb_ext.BidType, bool) {
return openrtb_ext.BidTypeBanner, false
}

func NewFacebookBidder(client *http.Client, platformID string, appID string, appSecret string) adapters.Bidder {
func NewFacebookBidder(client *http.Client, platformID string, appSecret string) adapters.Bidder {
if platformID == "" {
glog.Errorf("No facebook partnerID specified. Calls to the Audience Network will fail. Did you set adapters.facebook.platform_id in the app config?")
return &adapters.MisconfiguredBidder{
Expand All @@ -415,14 +413,6 @@ func NewFacebookBidder(client *http.Client, platformID string, appID string, app
}
}

if appID == "" {
glog.Errorf("No facebook app ID specified. Calls to the Audience Network will fail. Did you set adapters.facebook.app_id in the app config?")
return &adapters.MisconfiguredBidder{
Name: "audienceNetwork",
Error: errors.New("Audience Network is not configured properly on this Prebid Server deploy. If you believe this should work, contact the company hosting the service and tell them to check their configuration."),
}
}

if appSecret == "" {
glog.Errorf("No facebook app secret specified. Calls to the Audience Network will fail. Did you set adapters.facebook.app_secret in the app config?")
return &adapters.MisconfiguredBidder{
Expand All @@ -439,7 +429,6 @@ func NewFacebookBidder(client *http.Client, platformID string, appID string, app
//for AB test
nonSecureUri: "http://an.facebook.com/placementbid.ortb",
platformID: platformID,
appID: appID,
appSecret: appSecret,
}
}
2 changes: 1 addition & 1 deletion adapters/audienceNetwork/facebook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ type FacebookExt struct {
}

func TestJsonSamples(t *testing.T) {
adapterstest.RunJSONBidderTest(t, "audienceNetworktest", NewFacebookBidder(nil, "test-platform-id", "test-app-id", "test-app-secret"))
adapterstest.RunJSONBidderTest(t, "audienceNetworktest", NewFacebookBidder(nil, "test-platform-id", "test-app-secret"))
}
1 change: 0 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ type Adapter struct {

// needed for Facebook
PlatformID string `mapstructure:"platform_id"`
AppID string `mapstructure:"app_id"`
AppSecret string `mapstructure:"app_secret"`
}

Expand Down
4 changes: 2 additions & 2 deletions exchange/adapter_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package exchange

import (
"fmt"
"github.com/prebid/prebid-server/adapters/kubient"
"net/http"
"strings"

"github.com/prebid/prebid-server/adapters/kubient"

"github.com/prebid/prebid-server/adapters"
ttx "github.com/prebid/prebid-server/adapters/33across"
"github.com/prebid/prebid-server/adapters/adform"
Expand Down Expand Up @@ -111,7 +112,6 @@ func newAdapterMap(client *http.Client, cfg *config.Configuration, infos adapter
openrtb_ext.BidderFacebook: audienceNetwork.NewFacebookBidder(
client,
cfg.Adapters[strings.ToLower(string(openrtb_ext.BidderFacebook))].PlatformID,
cfg.Adapters[strings.ToLower(string(openrtb_ext.BidderFacebook))].AppID,
cfg.Adapters[strings.ToLower(string(openrtb_ext.BidderFacebook))].AppSecret),
}

Expand Down

0 comments on commit 4bf82f6

Please sign in to comment.