Sha256: ca3a7f3c260eeb8e0f482a57d886e171cc89447c9db5e8a457d5ea5b7b200b73

Contents?: true

Size: 467 Bytes

Versions: 4

Compression:

Stored size: 467 Bytes

Contents

# frozen_string_literal: true

require 'sinatra/base'

module ZohoHub
  class OauthCallbackServer < Sinatra::Base
    enable :logging

    CALLBACK_PATH = 'oauth2callback'

    get "/#{CALLBACK_PATH}" do
      grant_token = params[:code]

      # This will trigger a post request to get both the token and the refresh token
      @variables = ZohoHub::Auth.get_token(grant_token)

      puts "Variables: #{@variables.inspect}"

      erb :variables
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zoho_hub-0.4.2 lib/zoho_hub/oauth_callback_server.rb
zoho_hub-0.4.1 lib/zoho_hub/oauth_callback_server.rb
zoho_hub-0.4.0 lib/zoho_hub/oauth_callback_server.rb
zoho_hub-0.3.0 lib/zoho_hub/oauth_callback_server.rb