0

I have created nonce fro my plugin and trying to verify it with another plugin pages. it fails always. both we are creating nonce with same parameter. why it fails. Plugin name : Wordfence it creates nonce with wp_create_nonce('wp-ajax') i'm also doing the same. why it fails. they are passing it via $_GET and accessing it. why i cannot i'm also passing the via $GET.

any idea about it. they are creating in different file and verifying it in a different file. i'm also creating in my plugin file and trying to verify in their file.

What they are doing in menu.php.

they have a link with following code and finally creates nonce with wp-ajax

href="<?php echo wfUtils::siteURLRelative(); ?>?_wfsf=conntest&nonce=<?php echo wp_create_nonce( 'wp-ajax' ); ?>"

and checking in another file

$nonce = $_GET['nonce'];
if(! wp_verify_nonce($nonce, 'wp-ajax')){
  echo "Bad security token.";
  exit(0);
}
showSummary();

and i do the same thing

<?php echo $directPath; echo wp_create_nonce( 'wp-ajax' ); ?>"

when i click this link it goes to that page and $nonce = $_GET['nonce']; i can see the data in $nonce. but verifying end in fail

  • other than telling you you're doing something wrong, we can't answer your question without seeing any code. – Milo Sep 24 '15 at 17:08
  • @Milo any idea , i have added the code – Thamaraiselvam Sep 25 '15 at 8:42
  • There's a lot of context missing here. I'm not sure why you're creating a nonce with the same action that another plugin is using. – Milo Sep 25 '15 at 15:11
  • because i want to show the summary from my plugin of them. once nonce gets verified then i can get summary – Thamaraiselvam Sep 25 '15 at 15:18
  • what's the context of where you create and verify the nonce? what action do you do both on? have you tried creating your own unique nonce action? – Milo Sep 25 '15 at 16:29

Your Answer

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

Browse other questions tagged or ask your own question.