Module: Stagehand::Client::OAuth
- Included in:
- Stagehand::Client
- Defined in:
- lib/stagehand/client/oauth.rb
Overview
Methods for OAuth 2.0 authentication
Instance Method Summary collapse
- #access_token ⇒ Object
- #access_token_url ⇒ Object
-
#authorize_url ⇒ Object
URL used for initial OAuth login and authorization.
- #get_with_access_token(path, params) ⇒ Object
- #logout_url ⇒ Object
- #redirect_uri ⇒ Object
Instance Method Details
#access_token ⇒ Object
22 23 24 |
# File 'lib/stagehand/client/oauth.rb', line 22 def access_token request.env['rack.session'][:access_token] end |
#access_token_url ⇒ Object
10 11 12 |
# File 'lib/stagehand/client/oauth.rb', line 10 def access_token_url Stagehand.config.resource_host + "/oauth/access_token" end |
#authorize_url ⇒ Object
URL used for initial OAuth login and authorization
6 7 8 |
# File 'lib/stagehand/client/oauth.rb', line 6 def Stagehand.config.resource_host + "/oauth/authorize?client_id=#{Stagehand.config.client_id}&client_secret=#{Stagehand.config.client_secret}&redirect_uri=#{Stagehand.config.client_host}/callback" end |
#get_with_access_token(path, params) ⇒ Object
26 27 28 29 |
# File 'lib/stagehand/client/oauth.rb', line 26 def get_with_access_token(path, params) params[:oauth_token] = access_token HTTParty.get(Stagehand.config.resource_host + path, query: params) end |