Class: HashBlue::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/hash_blue/engine.rb

Overview

This class defines the HashBlue Rails Engine to handle OAuth authentication. The Engine defines two new routes to handle each of the OAuth steps 1.- forward the user request to HashBlue server 2.- get the oauth code, request a valid access token and forward the token info to a user defined action

How to configure HashBlue Engine

:uri => HashBlue API endpoint :client_id => token that identifies your application in OAuth mechanism :client_secret => token that secures your communication in OAuth mechanism :forward_action => controller#action where hashblue#code action will redirect the user token data:

- :access_token
- :expires_in
- :refresh_token

These configuration can be included in an application initializer, i.e. config/initializers/hashblue.rb

Rails.application.config.hashblue.client_id = "<client_id>"
Rails.application.config.hashblue.client_secret = "<client_secret"
Rails.application.config.hashblue.forward_action = "controller#action" that will receive the user token data