nevermined-io/node

Error when the buyer try to download the bought asset

Closed this issue · 7 comments

Currently is possible:

  • Publish
  • Download being the publisher
  • Buy the asset

However fail when the user is the buyer and try to download the bought asset with this error:

WebServiceConnector.js:249 Uncaught (in promise) Error: Http error with code 401: Request POST https://gateway.mumbai.public.nevermined.network/api/v1/gateway/services/oauth/token fail - {"statusCode":401,"message":"The 'client_assertion' is invalid: Payload: \"iss\" is not the signer of the payload 0x672C75Db51d29698f8B958ec42fdEa2a5Bde0E2f","error":"Unauthorized"}
    at WebServiceConnector.<anonymous> (WebServiceConnector.js:249:1)
    at Generator.next (<anonymous>)
    at fulfilled (WebServiceConnector.js:51:1)

This error happens having the next parameters:

{
  "did": "did:nv:d1660c3708918193f84a17d768658d9b4603a1ed6848297726df01a0933b3d1f",
  "nodeUrl": "https://matic-mumbai.chainstacklabs.com",
  "graphHttpUri": "https://api.thegraph.com/subgraphs/name/nevermined-io/common",
  "gatewayUri": "https://gateway.mumbai.public.nevermined.network",
  "gatewayAddress": "0x5838B5512cF9f12FE9f2beccB20eb47211F9B0bc",
}

Download asset is using this function of the sdk sdk.nfts.access(did, account) (did is did:nv:d1660c3708918193f84a17d768658d9b4603a1ed6848297726df01a0933b3d1f and account is the account of the buyer)

the graphHttpUri should be https://api.thegraph.com/subgraphs/name/nevermined-io/public since I assume you are using the public contracts

also the owner of that did is 0xf91d149be554304ddd391937f9dcf57341cfaf02 and not 0x672C75Db51d29698f8B958ec42fdEa2a5Bde0E2f are you sure you are only using one address?

Exactly 0xf91d149be554304ddd391937f9dcf57341cfaf02 is the owner and can download it, but the buyer with address 0x08BC177FC76d7472C6998eca68c6091970E01b0B can buy but cannot download it, I don't know why it says that the signer is 0x672C75Db51d29698f8B958ec42fdEa2a5Bde0E2f if it refer to the signer which I'm not sure

The signer is the account that is making a request to the gateway to download

can you share the code that you are using to publish buy and download?

This is really weird, the first time that I download with the buyer fail and the second time works

nvm_payload
dowload_second_time_works

Here you can see the code for publish here and here to buy

This issue come because the Catalog doesn't valid the address that signed the auth token against the current wallet address, then I can close this issue