Sha256: 3906c482f2ec64052731617595652978152250af14dc8dc125d2908104043e97

Contents?: true

Size: 790 Bytes

Versions: 7

Compression:

Stored size: 790 Bytes

Contents

module Oauth
  class AuthorizationController < ApplicationController
    def login
    end

    def authorize_hubspot
      url = Services::Hubspot::Authorization::GetAuthorizationUri.new(request: request).call
      redirect_to url
    end

    def hubspot_callback
      tokens = Services::Hubspot::Authorization::Tokens::Generate.new(
        code: params[:code],
        request: request
      ).call
      HubspotToken.instance.update_attributes(tokens)
      Services::Hubspot::Authorization::Authorize.new(tokens: HubspotToken.instance.attributes).call
      redirect_to '/'
    end

    def trello_callback
      trello_tokens = request.env["omniauth.auth"]['credentials']
      TrelloToken.instance.update_attributes(trello_tokens.to_hash)

      redirect_to '/'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hubspot-api-client-9.0.0 sample-apps/trello-integration-app/app/controllers/oauth/authorization_controller.rb
hubspot-api-client-8.0.1 sample-apps/trello-integration-app/app/controllers/oauth/authorization_controller.rb
hubspot-api-client-8.0.0 sample-apps/trello-integration-app/app/controllers/oauth/authorization_controller.rb
hubspot-api-client-7.3.0 sample-apps/trello-integration-app/app/controllers/oauth/authorization_controller.rb
hubspot-api-client-7.2.0 sample-apps/trello-integration-app/app/controllers/oauth/authorization_controller.rb
hubspot-api-client-7.1.1 sample-apps/trello-integration-app/app/controllers/oauth/authorization_controller.rb
hubspot-api-client-7.1.0 sample-apps/trello-integration-app/app/controllers/oauth/authorization_controller.rb