If anybody is strangling with it, the proper solution is to use both wp_set_auth_cookie
specifying the second parameter being the logged_in cookie, which now gives me the following code:
wp_set_current_user($user_id);
if ( wp_validate_auth_cookie( '', 'logged_in' ) != $user_id )
{
wp_set_auth_cookie( $user_id );
}
And to add an action, as suggested in this thread: Extend WordPress (4.x) session and nonce to have the logged-in current cookie properly overriden without needing a page refresh.
That was a tricky one for sure, and undocumented anywhere. Did anybody tried that yet ?
Thanks for your attention anyway,
Related Posts:
- How does nonce verification work?
- Nonce retrieved from the REST API is invalid and different from nonce generated in wp_localize_script
- How to expire a nonce?
- How do I create a user using the new JSON api in 4.7?
- Verify nonce in REST API?
- WordPress REST API call generates nonce twice on every call
- Fatal error: Call to undefined function wp_create_nonce()
- How to add/retrieve the post trash link?
- Using nonce external of WP Admin
- Nonce best practices: hidden input vs. wp_localize_script?
- Reduce nonce lifespan
- Headless WordPress: How to authenticate front end requests?
- “The link you followed has expired” when previewing a post
- wp_verify_nonce keeps failing
- WP REST API: check if user is logged in
- increase nonce lifespan
- Can’t GET draft posts via REST API from headless frontend
- Rest API invalid nonce with Backbone Client
- wp_verify_nonce() via REST always returns false
- Nonce failing in IE
- Full page NGINX (or Cloudflare) caching and WordPress nonces
- WordPress REST API, Expired Nonce from Cache results in 403 forbidden
- my theme breaks WP export
- Why am I getting a 403 from check_admin_referer()?
- Passing a borrowed nonce through Postman fails
- how to send Ajax request in wordpress backend
- permission_callback has no effect
- Identical wp_rest nonce returned from rest_api
- Return WP_Error as WP_REST_Response
- Is there an equivalent to WP_Error object I can return in the case of a successful REST request?
- WP REST API – Nonce passes wp_verify_nonce even after logout
- x-wp-nonce across domains
- wp_create_nonce doesn’t verify when using WP_List_Table
- Are nonces in WP REST API optional by default?
- Handling expired nonces
- What is really “wp_nonce_field” and how does it work? [duplicate]
- Rest API: wp_verify_nonce() fails despite receiving correct nonce value
- Cannot verify nonce
- wp_verify_nonce return false despite correct parameter passed
- WordPress JSON API nonces and Vue development server
- Verify a nonce in Form submission
- Backbone with custom rest endpoints
- phpcs error in WordPress
- Stop WordPress nonces expiring
- Several nonces?
- Nonce for Trashing Item
- Nonce keeps failing
- Public posts – preventing duplicate form submissions
- How to obtain “wp_rest” nonce for WP Statistics plugin manually?
- Log in user using WordPress REST API
- How to verify which WordPress user requested the API in ASP .NET Core?
- WordPress “nonce” message
- wp_nonce vs jwt
- CSP nonces with Cloudflare Workers
- Why are nonces working in Firefox but not in Chrome?
- wp_verfy_nonce keeps giving false
- Nonce – reissue with ajax poll
- wp_nonce_url generating invalid links
- Rest WP_Error always return null
- Register rest field authentication with REST API
- How to insert wp_nonce field within echoed string
- Nonce check causing issues when creating new post
- Weird nonce validation problem
- Logout button in menu without “wp” in links
- Rest API nonce is being cached
- WP REST API no longer supports filter param, so how do I get posts in a custom taxonomy?
- Modify WordPress Rest Api Request/Response
- Retrieve all users from wordpress database via REST/JSON API
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- WP REST API – Multisite – get posts from all sites
- REST API: No route was found matching the URL and request method
- WP REST API V2 – Modifying responses
- WP REST API, query total posts in a category
- Post to WordPress using REST API from external site
- get_userdata by username
- Transition from (classical) serialized custom meta field to (gutenberg) rest enabled meta
- How to insert Comment metadata via REST API
- ACF attachment custom field in rest response
- Is it possible to update a post meta field through REST API if the format of it when registered is nested?
- WP Rest endpoint with custom post type and ACF Fields
- WordPress REST API json – How to activate gzip compression?
- How to force JWT auth for default GET endpoints of WordPress rest api?
- post meta parameter in post custom-post-type endpoint with restapi
- how does the wordpress rest API work
- WP Rest Api- Update callback (POST request) to existing database table through the rest api
- Which route in the WP REST API do I access data passed into register_setting()?
- Fetching custom post type without knowing post type (REST API)
- Custom REST API POST Endpoint Not Working, 404 Error
- To stylize WP_Error messages or not?
- Deleting media using the WordPress Rest API
- localize_script or rest api
- Users REST API not working?
- AJAX form not working, still reloads on submit
- filter rest api post by a acf filed
- Redefine REST API variables
- custom REST endpoint not passing body of POST request to callback
- Best way to make a JSON API from WordPress?
- custom php file inside my custom folder of plugins directory is not caching
- Taxonomy term RestApi data 10 rows limitions
- I have front error for open website [closed]