调整Bot授权接口
This commit is contained in:
parent
3c51d69555
commit
3d0fa0d50c
|
@ -51,15 +51,14 @@ class InstallationsController < ApplicationController
|
|||
@install_bot = BotInstall.find params[:id]
|
||||
@bot = @install_bot.bot
|
||||
@application = Doorkeeper::Application.find_by(uid: @bot.client_id, secret: @bot.client_secret)
|
||||
if @application.present?
|
||||
# 给bot生成token,因为bot是机器人操作
|
||||
@access_token = Doorkeeper::AccessToken.create!({ :application_id => @application.id,
|
||||
:resource_owner_id => @bot.uid,
|
||||
:scopes => "public write",
|
||||
:expires_in => "604800",
|
||||
:use_refresh_token => true
|
||||
})
|
||||
end
|
||||
tip_exception("该Bot未激活") if @application.blank?
|
||||
# 给bot生成token,因为bot是机器人操作
|
||||
@access_token = Doorkeeper::AccessToken.create!({ :application_id => @application.id,
|
||||
:resource_owner_id => @bot.uid,
|
||||
:scopes => "public write",
|
||||
:expires_in => "604800",
|
||||
:use_refresh_token => true
|
||||
})
|
||||
render_ok(token: @access_token.token)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue