kin-android icon indicating copy to clipboard operation
kin-android copied to clipboard

Webhook for sign_transaction is not being fired/ credentials not forwarded

Open Akonobi1 opened this issue 3 years ago • 9 comments

In Kin.java, the getPassthroughAppUserCredentials() function gets called and the values logged, but Agora does not send them with a sign_transaction request on TestNet. **The credentials below are private.

2021-07-16 07:51:22.151 10549-10641/com.gftzhu.kindling I/System.out: account.accounts.isEmpty(): false 2021-07-16 07:51:22.867 10549-10640/com.gftzhu.kindling D/ContentValues: getPassthroughAppUserCredentials: xxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx 2021-07-16 07:51:23.020 10549-10641/com.gftzhu.kindling I/System.out: account.accounts.isEmpty(): false 2021-07-16 07:51:23.613 10549-10640/com.gftzhu.kindling D/ContentValues: getPassthroughAppUserCredentials: xxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx

These values never get sent to my server with a transaction request...

DEBUG:root:Received sign transaction request for <None,None> DEBUG:root:transaction approved: b'3kSwNYK7FmHTYG2pfH4JBQ91FAf6c8Kc4V32hv9So1ifAoMSJ5crpi58KiA5exvsiyjPUSCY2PbLvG1PLug74okX' (1 payments) INFO:werkzeug:54.87.229.123 - - [16/Jul/2021 09:51:24] "POST /sign_transaction HTTP/1.1" 200 - DEBUG:root:transaction completed: 89804f538a97a4cdbbd0752b329eb34de2675c52e4f8dea8538975c0e3db32da52565b38ebd69af9b74094bcd8251160c21c845efbaa3e85c8c3d95cfadb250c

Akonobi1 avatar Jul 16 '21 15:07 Akonobi1

@Akonobi1 what were you using for server side? Could you confirm it was Python? (We'll need to try and replicate it)

skyf0xx avatar Jul 20 '21 23:07 skyf0xx

I do use Python and the standard webhook.py in the examples dir of the python sdk

Akonobi1 avatar Jul 21 '21 04:07 Akonobi1

First step is to see if we can replicate this

skyf0xx avatar Jul 22 '21 00:07 skyf0xx

Any news on this issue?

Akonobi1 avatar Aug 23 '21 03:08 Akonobi1

Just a note that this is similar to this closed issue

https://github.com/kinecosystem/kin-android/issues/17

skyf0xx avatar Nov 02 '21 23:11 skyf0xx

Yes. I've seen that.

Nevertheless, since my python sign_transaction function (from the example webhook handler) approves requests, it ought also fetch the headers if the issue is fixed.

Since I use Java to initiate a spend from a device, either the Java code is not working well with the Kotlin-coded function, OR the provided example webhook handler has a problem with its logic.

I question whether it is simply a problem with our validator node because I think therein lies the problem with transactions not completing as well, of course a different issue altogether, but perhaps related.

Akonobi1 avatar Nov 03 '21 16:11 Akonobi1

I have confirmed the client side SDK was fixed - still testing back end.

skyf0xx avatar Nov 17 '21 08:11 skyf0xx

The back end is not firing for test net and production - the only hook that fires is for events but not sign_transaction. This was tested both with a webhook secret and without.

This is identical to @Akonobi1 report on discord.

Knowns:

  1. Issue originally in Android in getPassthroughAppUserCredentials() was fixed https://github.com/kinecosystem/kin-android/issues/17
  2. The webhook for event is triggered but sign_transaction is not being triggered in Test and Production for Python
  3. The webhook for event is triggered but sign_transaction is not being triggered in Test and Production for NodeJs

Conclusion:

The most likely cause is a bug in Agora

An alternate is that even if Android's getPassthroughAppUserCredentials() is now being triggered in Android, it may not be sending the correct header to Agora

Recommended action:

Test iOS and NodeJs/ Python

  1. If the sign transaction webhook fires, then the issue is in the Android SKD
  2. If the sign transaction webhook does not fire, then Agora needs to be tested

skyf0xx avatar Nov 18 '21 03:11 skyf0xx

Another issue as mentioned by @Akonobi1 is that when it fires, the credentials are not forwarded by Agora (just the message).

This was an older issue that seems to have been superseded by the hook not firing at all.

skyf0xx avatar Dec 10 '21 06:12 skyf0xx