OpenUpSA / health-e-story-db

Wordpress plugin to help Health-e maintain a syndication and impact database
0 stars 0 forks source link

Invalid nonce when trying to create new syndication #8

Open jbothma opened 7 years ago

jbothma commented 7 years ago

When trying to create a new syndication for a post, the ajax response is HTTP 403 with JSON response

{code: "json_cookie_invalid_nonce", message: "Cookie nonce is invalid"}

healthe-new-syndication-403-invalid-nonce

jbothma commented 7 years ago

I'm not sure what this might have to do with the nonce error - if the nonce thing is a red herring or this, but the WP REST API is supposed to be part of WP since WP 4.7. Yet I think I developed the plugin on WP 4.7 and had to install the beta WP Rest API 2 plugin for things to work then - perhaps now there's a conflict between the plugin and WP core?

what expected actual
Pods 2.6.7 Version 2.6.10
WP REST API 2 tested on 2.0-beta13.1 Version 2.0-beta15
wordpress 4.7? 4.8.1
jbothma commented 7 years ago

I don't know why the error talks about cookie nonce - we're using the nonceheader - see Request Headers in the screenshot and https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/

jbothma commented 7 years ago

On the post edit page, we set up the nonce to use in the request for each kind of syndication https://github.com/OpenUpSA/health-e-story-db/blob/master/libs/syndication_ui.php#L76 - there are many other nonce variables on the page.