Skip to content

Instantly share code, notes, and snippets.

@pochitax
Created October 31, 2025 13:04
Show Gist options
  • Select an option

  • Save pochitax/24c6f8463e53651a89525b0c50a570ce to your computer and use it in GitHub Desktop.

Select an option

Save pochitax/24c6f8463e53651a89525b0c50a570ce to your computer and use it in GitHub Desktop.
retornar el token
// 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