Login via hooks

184 Views Asked by At

I'm currently developing an application where holders can see historical data of their NFT's. All code is in place, but I'm still looking for a way to securely verify their ownership of a certain NFT. There is the possibility to extend one of the dApp examples in the MultiversX docs, but I'm not that familiar to React or NodeJS, so I'm trying to build this in PHP.

One thing I came across, is the login via Hooks, as used by the xExchange. https://docs.multiversx.com/wallet/webhooks/#login-hook

However, the Callback URL can be accessed manually by users, so this can give people Unauthorized access to my application.

Now, there is an undocumented extra parameter token I can pass to the Login hook (as used by xExchange). I know I can fetch a valid token by sending a POST request to 'https://id.maiar.com/api/v1/login/init'. This will give back a token I can append to the Callback URL. By doing so, the Callback URL will receive an appended signature parameter. I feel like I'm almost there, but the question is: How can I interpret this signature and how can I use this signature to verify if the returned response was valid and belongs to the given token/address? How was this signature is generated?

Also, I feel like it would be very nice if there was some sort of OAuth implementation for MultiversX, but since it isn't there, I'm trying this approach.

0

There are 0 best solutions below