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

186
Visualizações
How to authenticate with oAuth to use googles API?

I am trying to use googles API, which you can only used when authenticated with oAuth.

I have successfully obtained the access key, however I can't seem to be able to use it with the API. This is my code:

$accessToken = $client->fetchAccessTokenWithAuthCode($_GET["code"])["access_token"];

$ch = curl_init();

$url = "https://www.googleapis.com/androidpublisher/v2/applications/flarehubpe.flarehub.xflare/purchases/products/flarehubvip/tokens/fraud_token";
$headers = array("Authorization: Bearer $accessToken");

curl_setopt($ch, CURLOPT_URL, $url); # URL to post to
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); # return into avariable
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); # custom headers, see above
$result = curl_exec($ch); # run!
curl_close($ch);

var_dump("Result", $result);

//Outputs: "result" nothing else.

What am I doing wrong?

over 4 years ago · Santiago Trujillo
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