Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonce doesn't work for draft previews #267

Open
thelucre opened this issue Apr 2, 2020 · 1 comment
Open

Nonce doesn't work for draft previews #267

thelucre opened this issue Apr 2, 2020 · 1 comment

Comments

@thelucre
Copy link

thelucre commented Apr 2, 2020

I've been digging pretty thoroughly to solve this issue. In Wordpress 5.3.2 and Wordpress 5.4, maybe others, the nonce value isn't working for draft previews. I've tried this both with the Postlight repo and with a barebones install and frontend to make sure it's not plugin- or theme-related.

It appears that the session cookie is not set or sending through with the frontend rest call, therefore the nonce appears to be invalid. Anyone else having this problem with Postlight Headless WP?

I see a couple options moving forward:

  1. Figure out how to get the logged_id session cookie to the frontend domain and passed through with the AJAX request (best case)
  2. Use JWT Auth to make admins login to view draft previews.

Any thoughts on this issue or known workarounds?

Here's a detailed thread: https://wordpress.stackexchange.com/questions/363012/cant-get-draft-posts-via-rest-api-from-headless-frontend

@trst
Copy link

trst commented Jul 6, 2020

Ran into the same issue, would love to see a work around. Would JWT (in your conception @thelucre) require a user logged in the backend of WP to login again on the preview side? Or would there be some mechanism to store a JWT on logging in on the WP side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants