func (svc *basicAuthNService) ValidateToken(tokenString, kid string) (dto.CustomClaim, error) {
	claim := dto.CustomClaim{}

	kf := func(token *stdjwt.Token) (interface{}, error) {
		keyID := token.Header["kid"].(string)
		if keyID != kid {
			return claim, stdjwt.ErrInvalidKeyType
		}
		return []byte(svcconf.C.Auth.SecretKey), nil
	}

	token, err := stdjwt.ParseWithClaims(tokenString, &claim, kf)

	// check if signature is valid
	if err != nil {
		return claim, err
	}
	if token.Valid {
		return claim, nil
	}
	return claim, kitjwt.ErrTokenInvalid
}
// ValidateToken validates the given token based on the provided kid (KeyID)
ValidateToken validates the given token based on the provided kid (KeyID)
// ValidateToken validates the given token based on the provided kid ( KeyID )
func (svc *basicAuthNService) ValidateToken(tokenString, kid string) (dto.CustomClaim, error) {
	claim := dto.CustomClaim{}
	kf := func(token *stdjwt.Token) (interface{}, error) {
		keyID := token.Header["kid"].(string)
		if keyID != kid {
			return claim, stdjwt.ErrInvalidKeyType
		}
		return []byte(svcconf.C.Auth.SecretKey), nil
	}
	token, err := stdjwt.ParseWithClaims(tokenString, &claim, kf)
	if err != nil {
		return claim, err
	}
	if token.Valid {
		return claim, nil
	}
	return claim, kitjwt.ErrTokenInvalid
}
func ( svc * basicAuthNService ) ValidateToken ( tokenString , kid string ) ( dto . CustomClaim , error ) { claim := dto . CustomClaim { } kf := func ( token * stdjwt . Token ) ( interface { } , error ) { keyID := token . Header [ " " ] . ( string ) if keyID != kid { return claim , stdjwt . ErrInvalidKeyType } return [ ] byte ( svcconf . C . Auth . SecretKey ) , nil } token , err := stdjwt . ParseWithClaims ( tokenString , & claim , kf ) if err != nil { return claim , err } if token . Valid { return claim , nil } return claim , kitjwt . ErrTokenInvalid }
ValidateToken validates the given token based on the provided kid (KeyID)
ValidateToken validates the given token based on the provided kid ( KeyID )
// check if signature is valid