Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

456
Views
Error "[jwt_auth] nombre_de_usuario_vacío" con React JS - Token - Wordpress - iniciar sesión

Estoy trabajando para iniciar sesión con React JS y wordpress con el complemento JWT Authentication for WP REST API . Quisiera obtener token pero tengo un problema

El código está aquí:

 //... function Login() { const[username, setUsername] = useState("") const[password, setPassword] = useState("") const access = async () => { const response = await fetch(`http://wp-playground.test/wp-json/jwt-auth/v1/token`, { method: 'POST', header: { 'Content-Type' : 'application/json', }, body : JSON.stringify({ username: username, password: password }) }) const data = await response.json() console.log(data) setUsername("") setPassword("") } return ( <div> <h2>Login</h2> <label>Username: </label><input value={username} onChange={(e) => setUsername(e.target.value)}/><br/><br/> <label>Password: </label><input type="password" value={password} onChange={(e) => setPassword(e.target.value)}/><br/><br/> <button onClick={access}>Login</button> </div> )

y me sale asi:

 { code: "[jwt_auth] empty_username" data: { status: 403 } message: "<strong>Error</strong>: The username field is empty." }

¡Gracias por tu atención!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!