1

Specific example from a contract:

...
void hi(name user){
  // verification here, require_auth(user)?
  print(user);
}
...

I've tried require_auth(user) but that seems to always fail unless the user itself is the contract's creator.

Thanks!

  • Can you show us how you call the action? What kind of response do you get? – cmadh Apr 23 at 11:16
2

require_auth(user) will ensure the sender of the transaction has the correct permission, which is what you're intending. Perhaps the way you're calling the action is incorrect?

When using cleos push action ... the -p (or --permission) option allows you to specify the account authority you want to use.

0

OP here, lost the account I made this post with. I figured it out! Log:

$ cleos push action CONTRACT_NAME hi '[useruseruser]' -p CONTRACT_NAME
Error 3090004: Missing required authority
Ensure that you have the related authority inside your transaction!;
If you are currently using 'cleos push action' command, try to add the relevant authority using -p option.
Error Details:
missing authority of useruseruser
pending console output:

By doing cleos push action CONTRACT_NAME hi '[useruseruser]' -p useruseruser instead, it returns Hello, useruseruser. Since I have authority over the useruseruser account the action worked.

Thanks for the advice on where to look!

  • 1
    Glad you got there, I updated my answer to make it more clear as well :) – Jason Bert Apr 25 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.