I am trying to create a meeting on behalf of the logged in, authenticated user.
I've successfully created a user with Devise and Omniauth:
user.rb
def self.from_omniauth(auth)
where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
user.provider = auth.provider
user.uid = auth.uid
user.email = auth.info.email
user.name = auth.info.name
user.phonenumber = auth.info.phone_number
user.picurl = auth.info.pic_url
user.timezone = auth.info.timezone
user.password = Devise.friendly_token[0,20]
user.refresh_token = auth.credentials.refresh_token
user.access_token = auth.credentials.token
end
end
However, when making the request, I'm consistently getting HTTPUnauthorized 401: {\"code\":124,\"message\":\"Invalid access token.\"}"
Here's my controller:
def create
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.zoom.us/v2/users/me/meetings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Bearer ' + current_user.access_token
response = http.request(request)
puts response.read_body
end
the problem is simple you just have to change the userid, use your username appears in zoom profile page as sign-in email instead of me in the uri. your current url: " https://api.zoom.us/v2/users/ me /meetings" change with this: " https://api.zoom.us/v2/users/ your_email /meetings". once you change this just make sure you'vr been created token not expired or create it again after doing this changes and make it valid for atleast 1 day to test and then you can set its expiry custom.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.