Skip to content

Upgrading to dgrijalva/jwt-go/v4 #1873

Closed
@mariaefi29

Description

@mariaefi29

Issue Description

Dear developers,

First of all, thank you for creating and maintaining such a cool router! Very easy to use.

Second of all, could you please kindly update github.com/dgrijalva/jwt-go v3.2.0+incompatible to a version 4 that has modules and more reliable I guess.

Checklist

  • Dependencies installed
  • No typos
  • Searched existing issues and docs

Expected behaviour

I use a handler func that gets claims out of JWT token and checks roles.

It is similar to what you have in you docs:

func isAdmin(next echo.HandlerFunc) echo.HandlerFunc {
	return func(c echo.Context) error {
		user := c.Get("user").(*jwt.Token)
                 ...

I expected it to work :)

Actual behaviour

However, it failed if I use version 4 of jwt-go. The errors is
interface conversion: interface {} is *jwt.Token, not *jwt.Token (types from different packages)

Similar issue: dgrijalva/jwt-go#401

So in order to solve this issue I had to switch to v3.2.0 you are using.

Can we please fix it in version 5 due to compatibility break?

Version/commit

v4.1.15

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