Class: OmniAuth::Strategies::Zoom

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/zoom.rb

Overview

OmniAuth strategy for Zoom (zoom.us) OAuth 2.0.

Vendored verbatim from the abandoned omniauth-zoom gem (last
released 2021). That gem's newest version pinned
omniauth-oauth2 ~> 1.7.1, which conflicts with the
omniauth-oauth2 ~> 1.8 required by omniauth-google-oauth2 and
omniauth-linkedin-openid — so the gem was frozen at the 0.2.1 era
and could never be upgraded. Vendoring the ~50-line strategy
drops the dependency entirely and lets it run on the current
omniauth-oauth2 (1.9.x) like every other strategy. Behaviour is
identical to omniauth-zoom 0.2.1, which already ran against the
installed omniauth-oauth2 1.9.x.

Loaded via an explicit require in config/initializers/130_devise.rb
(the lib/omniauth directory is excluded from Zeitwerk autoloading
in config/application.rb — omniauth does not match the default
Omniauth inflection and reopening a gem-owned namespace under an
autoloaded path is unsafe).

Instance Method Summary collapse

Instance Method Details

#build_access_tokenOAuth2::AccessToken (protected)

Zoom's token endpoint expects the client credentials as HTTP
Basic auth and the grant params on the query string.

Returns:

  • (OAuth2::AccessToken)

    the built access token



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/omniauth/strategies/zoom.rb', line 39

def build_access_token
  params = {
    grant_type: 'authorization_code',
    code: request.params['code'],
    redirect_uri: callback_url
  }
  path = "#{client.options[:token_url]}?#{URI.encode_www_form(params)}"
  basic_auth = Base64.strict_encode64("#{client.id}:#{client.secret}")
  opts = { headers: { Authorization: "Basic #{basic_auth}" } }

  response = client.request(:post, path, opts)
  ::OAuth2::AccessToken.from_hash(client, response.parsed)
end