Weble / Zoom

Zoom PHP SDK
2 stars 1 forks source link

OAuth Server 2 Server #3

Open AronNovak opened 2 years ago

AronNovak commented 2 years ago

2

AronNovak commented 2 years ago

@Skullbock Ready for review.

<?php

require 'vendor/autoload.php';

// @see https://marketplace.zoom.us/docs/guides/build/server-to-server-oauth-app/
$account_id = '...';
$apiKey = "...";
$apiSecret = "...";

// Valid for 1 hour.
$oauth_token = \Weble\Zoom\OAuth::generateToken($apiKey, $apiSecret, $account_id);

$config = \Weble\Zoom\Configuration::getDefaultConfiguration()->setAccessToken($oauth_token);
$apiInstance = new \Weble\Zoom\Api\UsersApi(
    new \GuzzleHttp\Client(),
    $config
);

$users = $apiInstance->users();
print_r($users);

I tested with this and it worked like a charm.

AronNovak commented 2 years ago

Also as we use it for almost one year in production, we might remove this scary warning that basically makes sure others won't contribute to it :)

Skullbock commented 2 years ago

Hi Aron, great job! i would love to do a couple of more things (if you can help, glad to have your help!): [ ] Upgrade to min php 7.4 and support 8.0+ [ ] Drop Guzzle dependency, and move to the generic http://httplug.io/ implemenation (which guzzle implements) to allow for different http clients [ ] Use said client to generate the access token instead of raw http

AronNovak commented 2 years ago

Upgrade to min php 7.4 and support 8.0+

I'd say here it's out of scope, but for sure it's a logical move.

Skullbock commented 2 years ago

@AronNovak if you can, check #4 with the new requirements and some other stuff :)