class OmniAuth::Strategies::Feishu
Attributes
app_access_token[R]
Public Instance Methods
build_access_token()
click to toggle source
# File lib/omniauth/strategies/feishu.rb, line 57 def build_access_token resp = Faraday.post( options.client_options.token_url, { code: request.params["code"], app_access_token: app_access_token, grant_type: "authorization_code" }.to_json, content_type: "application/json" ) data = JSON.parse(resp.body)['data'] ::OAuth2::AccessToken.from_hash(client, data) end
callback_phase()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/feishu.rb, line 67 def callback_phase get_app_access_token super end
raw_info()
click to toggle source
# File lib/omniauth/strategies/feishu.rb, line 39 def raw_info @raw_info ||= begin response = Faraday.get( options.client_options.user_info_url, nil, content_type: 'application/json', authorization: "Bearer #{access_token.token}" ) response_body = JSON.parse(response.body) response_body['data'] end end
Private Instance Methods
get_app_access_token()
click to toggle source
# File lib/omniauth/strategies/feishu.rb, line 74 def get_app_access_token resp = Faraday.post( options.client_options.app_access_token_url, { app_id: options.client_id, app_secret: options.client_secret }.to_json, content_type: "application/json" ) response_body = JSON.parse(resp.body) if response_body.key?('app_access_token') @app_access_token = response_body['app_access_token'] else raise NoAppAccessTokenError, "cannot get app_access_token." end end