Skip to content

Commit

Permalink
Reverted to btoa function as Buffer increased SDK size
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Sep 6, 2021
1 parent 35f7529 commit a10dab6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions utils/EventRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ class EventRepository {

const headers = {
"Content-Type": "application/json",
Authorization: `Basic ${Buffer.from(`${this.writeKey}:`).toString(
"base64"
)}`,
AnonymousId: Buffer.from(message.anonymousId).toString("base64"),
Authorization: `Basic ${btoa(`${this.writeKey}:`)}`,
// Authorization: `Basic ${Buffer.from(`${this.writeKey}:`).toString(
// "base64"
// )}`,
AnonymousId: btoa(message.anonymousId),
// AnonymousId: Buffer.from(message.anonymousId).toString("base64"),
};

// modify the url for event specific endpoints
Expand Down
3 changes: 2 additions & 1 deletion utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ function getJSONTrimmed(context, url, writeKey, callback) {
xhr.open("GET", url, true);
xhr.setRequestHeader(
"Authorization",
`Basic ${Buffer.from(`${writeKey}:`).toString("base64")}`
`Basic ${btoa(`${writeKey}:`)}`
// `Basic ${Buffer.from(`${writeKey}:`).toString("base64")}`
);

xhr.onload = function () {
Expand Down

0 comments on commit a10dab6

Please sign in to comment.