fix: add token information in redirect url
This commit is contained in:
@@ -2,6 +2,7 @@ package token
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/crypto"
|
||||
@@ -91,6 +92,7 @@ func ParseJWTToken(token, hostname, nonce, subject string) (jwt.MapClaims, error
|
||||
return claims, errors.New("invalid audience")
|
||||
}
|
||||
|
||||
fmt.Println("claims:", claims, claims["nonce"], nonce)
|
||||
if claims["nonce"] != nonce {
|
||||
return claims, errors.New("invalid nonce")
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// CreateVerificationToken creates a verification JWT token
|
||||
func CreateVerificationToken(email, tokenType, hostname, nonceHash string) (string, error) {
|
||||
func CreateVerificationToken(email, tokenType, hostname, nonceHash, redirectURL string) (string, error) {
|
||||
claims := jwt.MapClaims{
|
||||
"iss": hostname,
|
||||
"aud": envstore.EnvStoreObj.GetStringStoreEnvVariable(constants.EnvKeyClientID),
|
||||
@@ -18,7 +18,7 @@ func CreateVerificationToken(email, tokenType, hostname, nonceHash string) (stri
|
||||
"iat": time.Now().Unix(),
|
||||
"token_type": tokenType,
|
||||
"nonce": nonceHash,
|
||||
"redirect_url": envstore.EnvStoreObj.GetStringStoreEnvVariable(constants.EnvKeyAppURL),
|
||||
"redirect_url": redirectURL,
|
||||
}
|
||||
|
||||
return SignJWTToken(claims)
|
||||
|
Reference in New Issue
Block a user