The error in request of access token (PHP-Laravel - > OAuth)

I write integration between zoom and education servise. My service use Laravel. I use OAuth authentification in Zoom App

The reason of my code is: https://artisansweb.net/how-to-create-a-meeting-on-zoom-using-zoom-api-and-php/

This is my function

function zoom_callback( Request $request){
        $client_id      = $this->client_id;
        $client_secret  = $this->client_secret;
        $redirect_uri   = $this->redirect_uri;
        
        $code = $request->code;
        
        $response = Http::withHeaders([
            'Authorization' => "Basic ". base64_encode($client_id.':'.$client_secret),
            'Content-Type'  => "application/x-www-form-urlencoded"
        ])->post('https://zoom.us/oauth/token', [
            "grant_type"    => "authorization_code",
            "code"          => $code,
            "redirect_uri"  => $redirect_uri
        ]);
        dump($response);
        
        $token = $response->getBody()->getContents();
        dump($token);
    }

Error
Where I send request I recieve error “{“reason”:“Missing grant type”,“error”:“invalid_request”}”

Can you help me where is the mistake?

Hi @titorovd

Thanks for reaching out to the Zoom Developer Forum, I am happy to help here!

Do you run into the same error when you test this request in Postman or using cURL?

Thanks,
Elisa

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.