OAuth API call (Get authorization code) - Laravel

Hello,

I am trying to get an authorization code from within the Laravel-based app. I am getting “Bad Request - 400” error.

$response = $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" => $_GET['code'],
            "redirect_uri" => "https://app.app.com/oauth/success",
        ]);

dd($response->getBody()->getContents())

Response below:

"{"reason":"unsupported grant type","error":"unsupported_grant_type"}"

I also noticed that the error remains as is even if the client id and client secret are incorrect.

Can someone please point me in the direction of how to rectify this?

Thanks a lot for the help.

Hi @epzoom
Welcome to our community! I am happy to help here!
make sure that you are grabbing the callback by Zoom