fix(plugin): authorization code redirect to static url (#191)
This commit is contained in:
@@ -20,12 +20,14 @@ package coze
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/application/plugin"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/plugin/conf"
|
||||
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/application/plugin"
|
||||
|
||||
bot_open_api "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_open_api"
|
||||
)
|
||||
|
||||
@@ -41,7 +43,7 @@ func OauthAuthorizationCode(ctx context.Context, c *app.RequestContext) {
|
||||
}
|
||||
|
||||
if req.Code == "" {
|
||||
invalidParamRequestResponse(c, "code is required")
|
||||
invalidParamRequestResponse(c, "authorization failed, code is required")
|
||||
return
|
||||
}
|
||||
if req.State == "" {
|
||||
@@ -49,11 +51,15 @@ func OauthAuthorizationCode(ctx context.Context, c *app.RequestContext) {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := plugin.PluginApplicationSVC.OauthAuthorizationCode(ctx, &req)
|
||||
_, err = plugin.PluginApplicationSVC.OauthAuthorizationCode(ctx, &req)
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
redirectURL := fmt.Sprintf("%s/information/auth/success", conf.GetServerHost())
|
||||
c.Redirect(consts.StatusFound, []byte(redirectURL))
|
||||
c.Abort()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user