Commit 6f0d7120 by mingyuan

add debug info

parent 6cc6f8eb
......@@ -10,19 +10,7 @@ module Dingtalk
def login
@dingtalk_user = @app.generate_user(params[:code])
if @oauth_user.account.nil? && current_account
@oauth_user.account = current_account
end
@oauth_user.save
if @oauth_user.user
login_by_oauth_user(@oauth_user)
Com::SessionChannel.broadcast_to(params[:state], auth_token: current_authorized_token.token)
else
url_options = {}
url_options.merge! params.except(:controller, :action, :id, :business, :namespace, :code, :state).permit!
url_options.merge! host: URI(session[:return_to]).host if session[:return_to]
end
@dingtalk_user.save
end
def create
......
......@@ -29,11 +29,12 @@ module Dingtalk
}
r = HTTPX.post "https://api.dingtalk.com/v1.0/oauth2/userAccessToken", body: h.to_json
result = JSON.parse(r.body.to_s)
logger.debug result
#binding.break
wechat_user = wechat_users.find_or_initialize_by(uid: result['openid'])
wechat_user.assign_attributes result.slice('access_token', 'refresh_token', 'unionid')
wechat_user.expires_at = Time.current + result['expires_in'].to_i
wechat_user
# wechat_user = wechat_users.find_or_initialize_by(uid: result['openid'])
# wechat_user.assign_attributes result.slice('access_token', 'refresh_token', 'unionid')
# wechat_user.expires_at = Time.current + result['expires_in'].to_i
# wechat_user
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment