Class: OmniAuth::Strategies::Chatwork
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Chatwork
- Defined in:
- lib/omniauth/strategies/chatwork.rb
Constant Summary collapse
- DEFAULT_SCOPE =
"rooms.all:read_write users.profile.me:read"
Instance Method Summary collapse
- #access_token_callback_url ⇒ Object
-
#authorize_params ⇒ Object
You can pass
scope
params to the auth request, if you need to set them dynamically. - #build_access_token ⇒ Object
- #raw_info ⇒ Object
Instance Method Details
#access_token_callback_url ⇒ Object
63 64 65 66 67 |
# File 'lib/omniauth/strategies/chatwork.rb', line 63 def access_token_callback_url # Remove query string from OmniAuth::Strategy#callback_url # https://github.com/omniauth/omniauth/blob/v1.7.1/lib/omniauth/strategy.rb#L438-L440 [:callback_url] || (full_host + script_name + callback_path) end |
#authorize_params ⇒ Object
You can pass scope
params to the auth request, if you need to set them dynamically. You can also set these options in the OmniAuth config :authorize_params option.
For example: /auth/chatwork?scope=rooms.all:read_write
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/omniauth/strategies/chatwork.rb', line 45 def super.tap do |params| %w[scope].each do |v| if request.params[v] params[v.to_sym] = request.params[v] end end params[:scope] ||= DEFAULT_SCOPE params[:scope] = Array(params[:scope]).join(" ") end end |
#build_access_token ⇒ Object
58 59 60 61 |
# File 'lib/omniauth/strategies/chatwork.rb', line 58 def build_access_token verifier = request.params["code"] client.auth_code.get_token(verifier, {:redirect_uri => access_token_callback_url}.merge(token_params.to_hash(:symbolize_keys => true)), deep_symbolize(.auth_token_params)) end |
#raw_info ⇒ Object
37 38 39 |
# File 'lib/omniauth/strategies/chatwork.rb', line 37 def raw_info @raw_info ||= access_token.get("me").parsed || {} end |