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

791
Views
OAuth - API de Google unsupported_grant_type

Ya estaba revisando otros hilos con el mismo error y todavía no pude solucionarlo.

Así que aquí está mi código PHP:

 $data = [ "client_id" => "id-here", "client_secret" => "secret-here", "refresh_token" => "refresh-token-here", "grant_type" => "refresh_token" ]; $ch = curl_init( 'https://www.googleapis.com/oauth2/v4/token' ); curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/x-www-form-urlencoded')); curl_setopt( $ch, CURLOPT_POSTFIELDS, $data ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); $result = curl_exec($ch); curl_close($ch); dd($result);

Como puede ver, tengo incluida la "aplicación/x-www-form-urlencoded", pero sigo recibiendo una respuesta:

 { "error": "unsupported_grant_type", "error_description": "Invalid grant_type: " }

Espero que alguien pueda ayudar. ¡Cualquier consejo, enlace o fragmento de código servirá! ¡Gracias!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

POST https://accounts.google.com/o/oauth2/token client_id={ClientId}&client_secret={ClientSecret}&refresh_token=[TOKEN]&grant_type=refresh_token

La llamada es una llamada http POST y los datos son una sola cadena con opciones separadas por un signo &.

Está enviando los datos de la publicación como una matriz.

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