I am trying to authenticate the owner of the account in the backend so I am using account_proof. Before I tried using 'accessNode.api': 'access.mainnet.nodes.onflow.org:9000'
but it gave me this error
Error: Response closed without headers
...
...
so I found a workaround which was to use 'accessNode.api': 'https://access-mainnet-beta.onflow.org'
and it was working fine yesterday but now it is giving this error
Error: failed to execute the script on the execution node execution-0ca407c1da940952ebcc02283b60cd97c9a008e111a48ea6cf1ce8f36f1e0153@execution-004.mainnet16.nodes.onflow.org:3569=100: rpc error: code = InvalidArgument desc = failed to execute script: failed to execute script at block (10cdbef077586db57b2949cd02e34cd0c051c2b236be1d828ecc2d227b93b73f): [Error Code: 1101] cadence runtime error Execution failed:
error: invalid argument at index 0: decodeing argument failed: [Error Code: 1052] transaction arguments are invalid: (argument is not json decodable: failed to decode value: invalid JSON Cadence structure)
--> a781c6cb2e8dc91d9e2e4a60358d60b61ea9f7215acae192a32cfeaffe7028e9
How can I solve this?
BTW I am using this method to verify the account Proving Ownership of a Flow Account - Flow Documentation
You can check for this.
"accessNode.api", "https://flow-access-mainnet.portto.io"
Hey thank you for the comment I used your solution and found a very weird error
` let data = blocto.services[5]?.data;
const address = data?.address;
const timestamp = data?.timestamp;
const Message =await WalletUtils.encodeMessageForProvableAuthnVerifying(
address, // Address of the user authenticating
timestamp, // Timestamp associated with the authentication
)
const CompositeSignatures = await fcl.currentUser().signUserMessage(Message);
const isValid = await fcl.verifyUserSignatures(Message, CompositeSignatures);
console.log(isValid);
const CompositeSignatures2=data.signatures;
const isValid2 = await fcl.verifyUserSignatures(
Message,
CompositeSignatures2
)
console.log(isValid2);`
What is the difference between isValid
and isValid2
. isValid
works perfectly fine but isValid2
throws an SyntaxError: Unexpected end of JSON input
error. Please help I have been trying to solve the issue for hours but getting no where. Also I console logged the compositeSignatures
and compositeSignatures2
and these are the results
compositeSignatures: [
{
0:
addr: "0xca5b85f57d71f86d"
f_type: "CompositeSignature"
f_vsn: "1.0.0"
keyId: 1
signature: "4bf89cc644f13cebc339d2ccc31c554c0511d2bc8dd40ec56aad3126717e79000845f81844fcffea11b5096c91e802918d221e557b37808fc2539896b6b7a38b"
[[Prototype]]: Object
length: 1
[[Prototype]]: Array(0)
}
]
compositeSignatures2:[
{ 0:
addr: "ca5b85f57d71f86d"
f_type: "CompositeSignature"
f_vsn: "1.0.0"
keyId: 1
signature: "218920f58af615f69c9fef668d23a076073e943fdfa987bb63220dcc7fd8435f33dc0ce4853c36ac96a4ab10188db211808479b2461ec44b0d3a1d34ac052eb4"
[[Prototype]]: Object
length: 1
[[Prototype]]: Array(0)}
]
As for my understanding, at first in flow isValid2 was used but after the upgrade, right me if I am wrong, I think so now isValid2 may be deprecated therefore it is giving a strange error. you can also check this post
http://forum.flow.com/t/is-it-possible-to-do-an-ecrecover-of-an-ethereum-address-in-a-cadence-contract/684
http://forum.flow.com/t/deploying-contracts-and-signing-transaction-from-node/657