Class: Imwukong::Client
- Inherits:
-
Object
- Object
- Imwukong::Client
- Defined in:
- lib/imwukong/client.rb
Overview
implement 阿里悟空支持的免导入登录方式 根据客户端类型(ios, android, web)返回 signature、domain、appkey、timestamp 等数据给客户端 客户端调用阿里悟空的SDK接口完成登录鉴权 目前采用openid就是用户应用的userid, 其唯一性由用户应用系统保障
Instance Method Summary collapse
Instance Method Details
#signature(open_id, dev_type) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/imwukong/client.rb', line 8 def signature(open_id, dev_type) fail %Q(unknown device type "#{dev_type}") unless %w(ios android).include?(dev_type) begin app_token = Imwukong.config[:server][:app_token] app_key = Imwukong.config[dev_type.to_sym][:app_key] app_secret = Imwukong.config[dev_type.to_sym][:app_secret] rescue raise 'Please check you configuration of imwukong' end nonce = rand(100000..200000) = Time.now.to_i { signature: gen_signature(open_id, app_token, app_secret, nonce, ), domain: Imwukong.config[:domain], open_id: open_id, app_key: app_key, nonce: nonce, timestamp: } end |