[wp-trac] [WordPress Trac] #43266: REST API JavaScript Client: Support an empty string for nonce

WordPress Trac noreply at wordpress.org
Thu Feb 8 22:12:59 UTC 2018


#43266: REST API JavaScript Client: Support an empty string for nonce
-------------------------+-----------------------------
 Reporter:  ocean90      |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:  4.9
 Severity:  normal       |   Keywords:  has-patch
  Focuses:  javascript   |
-------------------------+-----------------------------
 Related to #43265, #40422.

 Example:
 {{{#!js
 myApi = wp.api.init( {
         versionString: 'my-api/v1/'
         nonce: ''
 } );
 }}}

 In this case I don't want the client to include a nonce in requests at
 all. But because of the `args.nonce || wpApiSettings.nonce || ''`
 [https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/js/wp-
 api.js?marks=1477#L1473 line] it always falls back to
 `wpApiSettings.nonce`.

 A use case would be a read-only endpoint on another site in a multisite.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43266>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list