Gem OmniAuth 能否跳过 token 阶段 (不执行获取 token 阶段)

cdredfox · June 20, 2012 · Last by wu125816653 replied at June 19, 2018 · 3193 hits

Hi,

想咨询一下,关于 OmniAuth 能否跳过获取 token 阶段? 主要是因为目前正在写一个淘宝客网站登录淘宝的登录 gem,国内一些使用 OmniAuth 的公司,不按常理出牌,部分服务的登录方式,根据不需要换取令牌,所以想咨询一下,能否手工设置跳过获取 token 阶段?

他们的文档如下: http://open.taobao.com/doc/detail.htm?id=974

我的代码如下:

require 'omniauth/strategies/oauth2'
module OmniAuth
  module Strategies
    class Taobaoke < OmniAuth::Strategies::OAuth2
      option :name, "taobaoke"

      option :client_options, {
        :site => 'https://oauth.taobao.com/',
        :authorize_url => '/authorize',
        #:token_url => "/token"
      }

      option :authorize_params, {
        :response_type => 'user'
      }

      info do 
        { 
          :nickname => raw_info['nick'],
        }
      end

      extra do
        {
          #:raw_info => raw_info
        }
      end

      def raw_info

      end
    end
  end
end

OmniAuth.config.add_camelization('taobaoke', 'Taobaoke')
Unknow user #1 June 20, 2012

我有个疑问,不获取 token, 之后就不能访问 taobao 的 api, 那 oauth 还有什么意义呢 PS, 链接中 taobao 的页面,我不知道设置啥 encoding

他这个只是为了做登录~.

你好,想问下 option :name, "taobaoke"和 option :client_options 这里的 option 是什么意思?

You need to Sign in before reply, if you don't have an account, please Sign up first.