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

183
Views
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
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!