Skip to content

Commit 58b5e4a

Browse files
committed
fix(gauth): get redirect_uri correctly
1 parent 5811129 commit 58b5e4a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

httpapi/auth/gauth.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ func (h *GauthHandler) Login(c *gin.Context) {
6161
return
6262
}
6363

64+
redirectURI := c.Query("redirect_uri")
65+
if redirectURI == "" {
66+
redirectURI = h.oauthConfig.RedirectURL
67+
}
68+
6469
callbackURL, err := url.Parse(h.oauthConfig.RedirectURL)
6570
if err != nil {
6671
c.JSON(http.StatusInternalServerError, gin.H{
@@ -82,7 +87,7 @@ func (h *GauthHandler) Login(c *gin.Context) {
8287

8388
c.SetCookie(
8489
/* name */ redirectCookieName,
85-
/* value */ c.Request.URL.String(),
90+
/* value */ redirectURI,
8691
/* maxAge */ 5*60, // 5 min
8792
/* path */ "/",
8893
/* domain */ "",

0 commit comments

Comments
 (0)