Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

216
Visualizações
Can't get the response I want from Wordpress JWT Auth using React (Native). It works fine using Postman

I have an old Wordpress site. I installed the plugin JWT Auth so my React Native app can authenticate users from this website.

I have this React code:

function LoginScreen({navigation}) {
    const [username, setUsername] = React.useState('')
    const [password, setPassword] = React.useState('')
    const apiurl = 'https://wordpresswebsite.com/wp-json/jwt-auth/v1/token/'

    function submitLogin() {
                    
        axios.post(apiurl, {
            body: JSON.stringify({ username: username, password: password })
        })
        .then(function(response) {
            console.log(response)
        })
        .catch(function(err) {
            console.log(err)
        })

    }
}

The response I get is code: "jwt_auth_no_auth_header"

However, when I use Postman, I get the expected "code":"jwt_auth_valid_credential" without any problems.

What is going on here and how can I get the result like in Postman?

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda