Sha256: cbb5ad303cfacb9f1ffc79d62caf1a044ff1e4c1b3e78dd95d1b5475e7a2251b
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require 'omniauth/strategies/oauth2' module OmniAuth module Strategies class Wix < OmniAuth::Strategies::OAuth2 option :name, 'wix' option :client_options, { :authorize_url => 'https://www.wix.com/installer/install', :token_url => 'https://www.wix.com/oauth/access.json' } option :provider_ignores_state, true def client ::OAuth2::Client.new(options.client_id, options.client_secret, deep_symbolize(options.client_options)) do |b| b.request :json b.adapter Faraday.default_adapter end end def authorize_params super.tap do |params| params["redirectUrl"] = callback_url params["appId"] = options[:client_id] params["token"] = request.params["token"] end end def callback_url full_host + script_name + callback_path end def build_access_token verifier = request.params["code"] params = { :redirect_uri => callback_url }.merge(token_params.to_hash(:symbolize_keys => true).merge({ headers: { 'Content-Type' => 'application/json' } })) client.auth_code.get_token(verifier, params, deep_symbolize(options.auth_token_params)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-wix-0.1.0 | lib/omniauth/strategies/wix.rb |