[wp-trac] [WordPress Trac] #40422: REST API JavaScript Client: refresh nonce when a new nonce is available

WordPress Trac noreply at wordpress.org
Thu Sep 21 12:57:18 UTC 2017


#40422: REST API JavaScript Client: refresh nonce when a new nonce is available
------------------------------+------------------------------
 Reporter:  adamsilverstein   |       Owner:  adamsilverstein
     Type:  enhancement       |      Status:  closed
 Priority:  normal            |   Milestone:  4.9
Component:  REST API          |     Version:  4.7
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:  javascript
------------------------------+------------------------------
Changes (by adamsilverstein):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"41553"]:
 {{{
 #!CommitTicketReference repository="" revision="41553"
 REST API JS Client: Improve nonce handling, refresh stale nonce on sync.

 Keep the nonce used for cookie based authentication fresh by pulling in
 and using any new nonce supplied in the response headers.

 * Enable passing nonce to init so each api/endpoint can use a unique
 nonce.
 * Store nonce for endpoint on endpointModel.
 * New model helper `nonce()` retrieves a model's routeModel nonce.
 * When a response header contains a nonce that doesn't match the stored
 nonce, replace it.

 Fixes #40422.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40422#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list