Strategy to authenticate with Gong via OAuth2 in OmniAuth.
You can get your OAuth app client id and secret from - https://us-55616.app.gong.io/company/api-authentication
Gong OAuth app docs - https://help.gong.io/hc/en-us/articles/360056677792-Create-an-app-for-Gong
Add to your Gemfile
:
gem 'omniauth-gong'
Then bundle install
.
- Go to
https://us-55616.app.gong.io/company/api-authentication
- Follow the instructions in https://help.gong.io/hc/en-us/articles/360056677792-Create-an-app-for-Gong
Here's an example for adding the middleware to a Rails app in config/initializers/omniauth.rb
:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :gong,
Rails.application.credentials.dig(:gong, :client_id),
Rails.application.credentials.dig(:gong, :client_secret),
scope: 'api:calls:read:basic'
end
You can now access the OmniAuth Gong URL: /auth/gong
NOTE: While developing your application, if you change the scope in the initializer you will need to restart your app server.
You can configure several options, which you pass in to the provider
method via a hash:
scope
: A space-separated list of permissions you want to request from the user.
Here's an example of a possible configuration
Rails.application.config.middleware.use OmniAuth::Builder do
provider :gong,
Rails.application.credentials.dig(:gong, :client_id),
Rails.application.credentials.dig(:gong, :client_secret),
scope: 'api:calls:read:extensive api:calls:read:media-url'
end
See LICENSE