Skip to content

Commit 3ef2765

Browse files
authored
Merge pull request #2 from AppsFlyerSDK/hmac-ascii-to-utf
HmacSha256Digest encoding - ASCII->UTF8
2 parents 38e64b6 + 4a6a264 commit 3ef2765

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Assets/AppsflyerModule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ private string GenerateGuid()
291291
// generate hmac auth for post requests
292292
private string HmacSha256Digest(string message, string secret)
293293
{
294-
ASCIIEncoding encoding = new ASCIIEncoding();
294+
UTF8Encoding encoding = new UTF8Encoding();
295295
byte[] keyBytes = encoding.GetBytes(secret);
296296
byte[] messageBytes = encoding.GetBytes(message);
297297
System.Security.Cryptography.HMACSHA256 cryptographer =

Assets/AppsflyerScript.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ void Start()
1515
AppsflyerModule afm = new AppsflyerModule(DEV_KEY, APP_ID, this, IS_SANDBOX);
1616
afm.SetCustomerUserId("testTEST12345");
1717
afm.Start();
18-
afm.SetCustomerUserId("testTESTNOPE");
19-
afm.Stop();
2018

2119
// set event name
2220
string event_name = "af_purchase";
@@ -25,9 +23,13 @@ void Start()
2523
event_parameters.Add("af_currency", "USD");
2624
event_parameters.Add("af_price", 6.66);
2725
event_parameters.Add("af_revenue", 12.12);
26+
event_parameters.Add("goodsName", "新人邀约购物日");
2827
// send logEvent request
2928
afm.LogEvent(event_name, event_parameters);
3029

30+
// afm.SetCustomerUserId("test-willnotwork");
31+
// afm.Stop();
32+
3133
// the creation date in this example is "2023-03-23T08:30:00+00:00"
3234
bool newerDate = afm.IsInstallOlderThanDate("2023-06-13T10:00:00+00:00");
3335
bool olderDate = afm.IsInstallOlderThanDate("2023-02-11T10:00:00+00:00");

0 commit comments

Comments
 (0)