diff --git a/server/oauth2/auth.go b/server/oauth2/auth.go index 95a4c2b..2dfb292 100644 --- a/server/oauth2/auth.go +++ b/server/oauth2/auth.go @@ -201,6 +201,7 @@ func newAuthFunc(redirect string) stateHandler { } } else if ctx.Request.Method == http.MethodPost { ctx.JSON(http.StatusOK, model.NewApiDataResp(gin.H{ + "type": CallbackTypeAuth, "role": user.Role, "token": token, "redirect": redirect, diff --git a/server/oauth2/bind.go b/server/oauth2/bind.go index 35ac593..7e14d17 100644 --- a/server/oauth2/bind.go +++ b/server/oauth2/bind.go @@ -91,6 +91,7 @@ func newBindFunc(userID, redirect string) stateHandler { } ctx.JSON(http.StatusOK, model.NewApiDataResp(gin.H{ + "type": CallbackTypeBind, "redirect": redirect, })) } diff --git a/server/oauth2/model.go b/server/oauth2/model.go new file mode 100644 index 0000000..a9b15ce --- /dev/null +++ b/server/oauth2/model.go @@ -0,0 +1,8 @@ +package auth + +type CallbackType string + +const ( + CallbackTypeAuth CallbackType = "auth" + CallbackTypeBind CallbackType = "bind" +)