kyleboe / zoom_rb

Ruby REST API Wrapper for zoom.us API
https://developers.zoom.us/docs/api/
MIT License
83 stars 104 forks source link

Unclear documentation on OAuth clients #420

Open teal-bauer opened 2 years ago

teal-bauer commented 2 years ago

The README confused me when trying to make an OAuth app work because I didn't realize how to set client_id and client_secret and got opaque errors about api_key not being defined.

I would suggest two things:

  1. Make README more explicit, with separate subparts for JWT and OAuth flows, stating explicitly that for OAuth the api_key = client_id and api_secret = client_secret; and
  2. Adding method aliases for Zoom::Configuration so c.client_id = ... and c.client_secret = ... work
kyleboe commented 1 year ago

I'll be cleaning this up as a part of #458 :+1:

benterova commented 9 months ago

Any update on this? Looks like the JWT deprecation has passed and OAuth implementation details are still sparse. Also looks like this PR doesn't include information relating to the differences between client and server-to-server OAuth.

bockets commented 5 months ago

I took a slightly different approach than the README to get the necessary access token:

uri = URI.parse("https://zoom.us/oauth/token")
request = Net::HTTP::Post.new(uri)

# Get client_id, client_secret and account_id from the OAuth dashboard at https://marketplace.zoom.us/user/build
request.basic_auth(client_id, client_secret)
request.set_form_data(
  "grant_type" => "account_credentials",
  "account_id" => account_id,
)

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

Then this response's access token can be plugged into an OAuth client:

Zoom::Client::OAuth.new(access_token: JSON.parse(response.body)["access_token"])