Skip to content

*jwt.Token, not *jwt.Token. middlware/jwt should be migrated from the current JWT project. #1938

Closed
@ManuelLG92

Description

@ManuelLG92

I've been having a bug using jwt middleware because it uses "github.com/dgrijalva/jwt-go" package but this package isn't maintained see issue 462 and it has been migrated to another project https://github.com/golang-jwt/jwt, in fact, it's the same project with others collaborators

Expected behaviour:
interface conversion: interface {} is *jwt.Token, equals to *jwt.Token

Actual behavior:

echo: http: panic serving 127.0.0.1:36350: interface conversion: interface {} is *jwt.Token, not *jwt.Token (types from different packages). As you can see are the same type but different package, It's because I use github.com/golang-jwt/jwt which is the recommended package by dgrijalva in his github page dgrijalva.

Code:

  `	config := middleware.JWTConfig{
	Claims:     &security.JwtCustomClaims{},
	SigningKey: []byte("secret"),
	ContextKey: "authenticated",
        }
   `

middleware.JWTConfig ( middleware/jwt) dependencies:
import ( "fmt" "net/http" "reflect" "strings" "github.com/dgrijalva/jwt-go" "github.com/labstack/echo/v4" )
This "github.com/dgrijalva/jwt-go" dependency should be changed by "github.com/golang-jwt/jwt", therefore the imports will so:

  `
   import (
"fmt"
"net/http"
"reflect"
"strings"
"github.com/golang-jwt/jwt"
"github.com/labstack/echo/v4"
     )
  `

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions