Skip to content

Commit 360dd3c

Browse files
committed
fix: redirect uri
1 parent c6add0c commit 360dd3c

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

server/handlers/oauth_callback.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func OAuthCallbackHandler() gin.HandlerFunc {
214214
if strings.Contains(redirectURL, "?") {
215215
redirectURL = redirectURL + "&" + params
216216
} else {
217-
redirectURL = redirectURL + "?" + params
217+
redirectURL = redirectURL + "?" + strings.TrimPrefix(params, "&")
218218
}
219219

220220
c.Redirect(http.StatusTemporaryRedirect, redirectURL)

server/handlers/verify_email.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ func VerifyEmailHandler() gin.HandlerFunc {
4242

4343
// verify if token exists in db
4444
hostname := parsers.GetHost(c)
45-
log.Debug("hostname used for jwt verification: ", hostname)
4645
claim, err := token.ParseJWTToken(tokenInQuery, hostname, verificationRequest.Nonce, verificationRequest.Email)
4746
if err != nil {
4847
log.Debug("Error parsing token: ", err)
@@ -116,7 +115,7 @@ func VerifyEmailHandler() gin.HandlerFunc {
116115
if strings.Contains(redirectURL, "?") {
117116
redirectURL = redirectURL + "&" + params
118117
} else {
119-
redirectURL = redirectURL + "?" + params
118+
redirectURL = redirectURL + "?" + strings.TrimPrefix(params, "&")
120119
}
121120

122121
go db.Provider.AddSession(models.Session{

server/resolvers/magic_link_login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func MagicLinkLoginResolver(ctx context.Context, params model.MagicLinkLoginInpu
197197
if strings.Contains(redirectURL, "?") {
198198
redirectURL = redirectURL + "&" + redirectURLParams
199199
} else {
200-
redirectURL = redirectURL + "?" + redirectURLParams
200+
redirectURL = redirectURL + "?" + strings.TrimPrefix(redirectURLParams, "&")
201201
}
202202

203203
verificationType := constants.VerificationTypeMagicLinkLogin

server/token/jwt.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"errors"
55

66
"github.com/golang-jwt/jwt"
7-
log "github.com/sirupsen/logrus"
87

98
"github.com/authorizerdev/authorizer/server/constants"
109
"github.com/authorizerdev/authorizer/server/crypto"
@@ -117,7 +116,6 @@ func ParseJWTToken(token, hostname, nonce, subject string) (jwt.MapClaims, error
117116
intIat := int64(claims["iat"].(float64))
118117
claims["exp"] = intExp
119118
claims["iat"] = intIat
120-
log.Debug("claims: ", claims)
121119
clientID, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyClientID)
122120
if err != nil {
123121
return claims, err
@@ -199,7 +197,6 @@ func ParseJWTTokenWithoutNonce(token, hostname string) (jwt.MapClaims, error) {
199197
intIat := int64(claims["iat"].(float64))
200198
claims["exp"] = intExp
201199
claims["iat"] = intIat
202-
log.Debug("claims: ", claims)
203200
clientID, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyClientID)
204201
if err != nil {
205202
return claims, err

0 commit comments

Comments
 (0)