For remote apps (cURL, Postman, etc.), or when not using the browser, you should use an authentication plugin like Application Passwords instead of sending the cookies.
But if you’d rather send the cookies, then copy and send the WordPress logged-in cookie named wordpress_logged_in_<hash>. Example in cURL:
curl -H "X-WP-Nonce: <nonce>" -X POST https://example.com/wp-json/wp/v2/posts -d "Data here" -b wordpress_logged_in_<hash>=<cookie value>
Note that WordPress saves the user’s login data (username and hashed data) in a cookie named wordpress_logged_in_<hash> (but you can change it using the LOGGED_IN_COOKIE constant).
Also, in the above (cURL) example, I used the X-WP-Nonce header to send the cookie nonce.
UPDATE: Added a screenshot for (locating and copying) the cookie in Chrome:
Related Posts:
- Can’t GET draft posts via REST API from headless frontend
- Log in user using WordPress REST API
- Headless WordPress: How to authenticate front end requests?
- WP REST API: check if user is logged in
- x-wp-nonce is not allowed by Access-Control-Allow-Headers in preflight response
- WordPress REST API “rest_authentication_errors” doesn’t work external queries?
- Full page NGINX (or Cloudflare) caching and WordPress nonces
- WordPress REST API, Expired Nonce from Cache results in 403 forbidden
- How send get request to external api with username and password
- WP_REMOTE_POST Requests are being blocked by API provider [closed]
- permission_callback has no effect
- Get all PDF files from page with WordPress API
- WP REST API – Nonce passes wp_verify_nonce even after logout
- “No Access-Control-Allow-Origin header is present” even though it is in the entry file
- Validate rest-api call on create
- Rest API: wp_verify_nonce() fails despite receiving correct nonce value
- Get a remote post ID via API given URL
- How to change the date and time in REST API for comments?
- Backbone with custom rest endpoints
- WordPress HTTP API NTLM Authentication
- [Zapier + WP Webhooks Pro]: Custom Fields get cut off at first comma or semicolon
- REST API and filtering by meta value
- Rest API: trouble receiving response through script (browser and Postman display correctly)
- Is there a way I can fetch the WordPress Developer Code References with an API?
- How to display relations via wordpress Rest API
- How to add Relations of a CCT from JetEngine via WordPress Rest API
- How to verify which WordPress user requested the API in ASP .NET Core?
- Can I overwrite default WordPress Json API For no more pages text
- trigger WordPress rest any API call
- Secure WordPress API, how?
- wp_nonce vs jwt
- register/login api
- WordPress REST API in Integromat: How to overcome “Sorry, you are not allowed to list users / edit this…”
- how to create JSON array [] for REST response?
- Remove unwanted fields from WP API response
- How to receive JSON payload from a digital device
- The REST API encountered an error in wordpress?
- WordPress API “code”:”rest_no_route” with Custom Route
- Connecting WordPress with an External API
- WordPress single page website redirect to index.html
- Autotrader API Integration
- REST API get featured image source for custom post type
- Register rest field authentication with REST API
- Update post / page using API + python
- JS WordPress API fetch no response headers
- Issue with API after 6.2 update
- Woocommerce API for calling products by Category ID
- Rest API nonce is being cached
- All wp-json routes suddenly return 404
- WordPress – Contact Form 7 – Get uploaded file issue
- Nonce validation in REST API
- API call from searchbar in wordpress
- Looking for a working code example in python for creating a post
- Transmit headers and footers via API from one site to another
- WordPress Error uploading image: 401 API Python Script
- WP REST API — How to change HTTP Response status code?
- Understanding SHORTINIT with WordPress 5
- Filter post_content before loading in Gutenberg editor
- Options to get my custom post type metadata via the WordPress API
- WP REST API returns incorrect data?
- REST API GET users
- Make authorization mandatory on custom routes
- Why the Path is different with the one coded in rest
- rest_api_init is run on every rest call to endpoint
- WP-REST create user with custom meta
- receive a custom parameter with rest api
- Setting cookies in WP REST API requests
- WordPress REST API rest_comment_invalid_author Sorry, you are not allowed to edit ‘author’ for comments
- How to delete user using rest api without reassigning
- Custom REST endpoint not working to retrieve single posts (“rest_no_route”)
- Accessing private posts through REST API, same code that works in remote doesn’t in local
- Advanced Access Manager: RESTful endpoint to refresh token
- How to add an endpoint for my custom post type? /wp-json/wp/v2/posts is working but it didn’t in the custom post
- Error message: Response is not a valid JSON response
- Pass multiple tags slug to rest API
- Return a WP_REST_Response from an inner function (and not from the root callback)
- register_rest_route with method POST but in wp-json/ is showing GET
- Rest Api fetching only one random post
- Accessing Custom REST endpoint with rest_do_request()
- Do i need to use a plugin for third party api integration?
- WP CLI in WP 5.3 with PHP 7.4
- Get wordpress post with featured image, category and tag from WordPress API
- REST API and Loopback error
- Rest API: Register and Login errors aren’t specific
- How can I secure my custom rest api endpoint or add under a already existing rest group
- WordPress RESTAPI – Restrict unknown
- Fix Characters WordPress Ionic App
- WordPress REST API Endpoint (Authors and Categories latest posts)
- Can we use website data which is having wp rest api plugin?
- REST API And Error Codes – No Message
- how can I add an URL parameter to a rest route using register_rest_route()?
- Is it possible to bulk update a table using WP Rest API?
- WordPress API standard compliance and specification for external database [closed]
- Delete row from table using custom endpoint via API
- Fetch post by author slug
- Cant POST with REST API on WordPress
- get the current logged in user using WooCommerce API in React App [closed]
- Problem with custom WordPress Rest API search route with query parameters
- How to limit what fields are returned through the WP API Backbone JS client
- WordPress just for Backend
