Created
October 31, 2025 13:04
-
-
Save pochitax/24c6f8463e53651a89525b0c50a570ce to your computer and use it in GitHub Desktop.
retornar el token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // FUNCIÓN PARA OBTENER EL TOKEN | |
| fetch('http://localhost:8888/wp-headless/wordpress/wp-json/jwt-auth/v1/token', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ | |
| username: 'admin', | |
| password: 'admin123' | |
| }) | |
| }) | |
| .then(res => res.json()) | |
| .then(data => console.log(data)) | |
| .catch(err => console.error(err)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment