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

104
Visualizações
Are there preventions to making HTTPS request on IOS for React Native? Can't make fetch requests on IOS with React Native

so I'm trying to create a get request to the Google OAuth2 API in React Native using React Query, where I pass in an authorization header and I'm supposed to get basic information about that user, like their name, email, profile pic. The code works and retrieves the data on the Web and Android, but does not work on IOS. As of now, I've tried using different ways of fetching the data, like Axios, instead of the built in fetch function, but it's always stuck on loading.

Here's the code for making the fetch request:

const { isLoading, error, data } = useQuery("userData", async () => {
    const response = await fetch(
      "https://www.googleapis.com/oauth2/v3/userinfo",
      {
        method: "GET",
        headers: {
          Accept: "application/json",
          Authorization: `Bearer ${accessToken}`,
          "Content-Type": "application/json",
        },
      }
    );
    return await response.json();
  });

where the access token is retrieved through a useContext call. This is what I return from my component:

return (
    <View
      style={{
        backgroundColor: "green",
        flex: 1,
        justifyContent: "center",
        alignItems: "center",
      }}
    >
      <Text style={{ color: "white" }}>{data.email}</Text>
    </View>
  );
};
about 4 years ago · Juan Pablo Isaza
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