Skip to content

Commit

Permalink
fix: add oauth2 callback type
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiren233 committed Oct 12, 2024
1 parent 900da0a commit 7f35a95
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/oauth2/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions server/oauth2/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func newBindFunc(userID, redirect string) stateHandler {
}

ctx.JSON(http.StatusOK, model.NewApiDataResp(gin.H{
"type": CallbackTypeBind,
"redirect": redirect,
}))
}
Expand Down
8 changes: 8 additions & 0 deletions server/oauth2/model.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package auth

type CallbackType string

const (
CallbackTypeAuth CallbackType = "auth"
CallbackTypeBind CallbackType = "bind"
)

0 comments on commit 7f35a95

Please sign in to comment.