Module: Lark::Apis::Authen
- Defined in:
- lib/lark/apis/authen.rb
Instance Method Summary collapse
- #access_token(code) ⇒ Object
- #index(redirect_uri, state = '') ⇒ Object
- #refresh_access_token(token) ⇒ Object
- #user_info(user_access_token) ⇒ Object
Instance Method Details
#access_token(code) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/lark/apis/authen.rb', line 11 def access_token(code) request.post 'authen/v1/access_token', { code: code, app_access_token: app_access_token, grant_type: 'authorization_code' } end |
#index(redirect_uri, state = '') ⇒ Object
6 7 8 9 |
# File 'lib/lark/apis/authen.rb', line 6 def index(redirect_uri, state = '') uri = ERB::Util.url_encode(redirect_uri) "#{URI.join(Lark.api_base_url, 'authen/v1/index')}?redirect_uri=#{uri}&app_id=#{app_id}&state=#{state}" end |
#refresh_access_token(token) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/lark/apis/authen.rb', line 19 def refresh_access_token(token) request.post 'authen/v1/refresh_access_token', { refresh_token: token, app_access_token: app_access_token, grant_type: 'refresh_token' } end |
#user_info(user_access_token) ⇒ Object
27 28 29 |
# File 'lib/lark/apis/authen.rb', line 27 def user_info(user_access_token) request.get 'authen/v1/user_info', { access_token: user_access_token } end |