Class: OmniAuth::Dingtalk::Client::EnterpriseInternal
- Defined in:
- lib/omniauth-dingtalk/client/enterprise_internal.rb
Constant Summary collapse
- TOKEN_URL =
'/gettoken'
Constants inherited from Base
Base::AUTHORIZE_URL, Base::GET_USER_ID_BY_UNIONID_URL, Base::GET_USER_INFO_BY_CODE_URL, Base::GET_USER_INFO_BY_ID_URL
Instance Method Summary collapse
Methods inherited from Base
#get_token, #get_user_id_by_unionid, #get_user_info_by_code, #get_user_info_by_id, #initialize, #token_url
Constructor Details
This class inherits a constructor from OmniAuth::Dingtalk::Client::Base
Instance Method Details
#get_user_info(params = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/omniauth-dingtalk/client/enterprise_internal.rb', line 15 def get_user_info(params = {}) resp = get_user_info_by_code(params[:code]) user_info = resp['user_info'] || {} return user_info if user_info['unionid'].to_s.empty? user_id = get_user_id_by_unionid(params[:access_token], user_info['unionid']).dig('result', 'userid') return user_info if user_id.to_s.empty? result = get_user_info_by_id(params[:access_token], user_id)['result'] user_info.merge(result || {}) end |
#token_params ⇒ Object
11 12 13 |
# File 'lib/omniauth-dingtalk/client/enterprise_internal.rb', line 11 def token_params { appkey: id, appsecret: secret } end |