Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

facebook: removed Auth-Token from header (replaced by authentication_id in the request body) #1113

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Auth-Token" is gone but, from the PR title, should we expect to have an "authentication_id" field added inside body as shown below? I don't see that addition in the PR diff, is this field already there or will it be implemented later?

39 {
40     "expectedRequest": {
41         "uri": "https://an.facebook.com/placementbid.ortb",
42         "headers": {
43             "Accept": [
44                 "application/json"
45             ],
46   -         "Auth-Token": [
47   -             "test-app-id|test-app-secret"
48   -         ],
49             "Content-Type": [
50                "application/json;charset=utf-8"
51            ],
52            "X-Fb-Pool-Routing-Token": [
53                "v4_bidder_token"
54            ]
55        },
56        "body": {
57 +          "authentication_id": "some-id-here"
58            "id": "test-req-id",
59            "imp": [
adapters/audienceNetwork/audienceNetworktest/exemplary/banner.json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guscarreon authentication_id already exists is the request body. In this file it's here:

"authentication_id": "b2f9edfd707106adb6b692520081ad7e2a345444af1a895310228297a1b6247e",

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh I completely missed it Mansi. I looked for it in the codebase but probably probably mistyped it and that's the reason I didn't find it. Pretty good catch

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 @@ -109,7 +110,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