/** * Obtain a pair of read and write nonces (authorisation tokens). Uses the posted website_id to store the nonces against. * @return string Nonce tokens in a JSON format. */ public function get_read_write_nonces() { $writeNonce = security::create_nonce('write', $_POST['website_id']); $readNonce = security::create_nonce('read', $_POST['website_id']); echo '{"read":"' . $readNonce . '","write":"' . $writeNonce . '"}'; }