Skip to content

JWT with RS256 not Working for me #897

Closed
@ghost

Description

Description

I tried to implement JWT with the RS256 Algorithm, but it doesn't work for me. I found already this Issue where an example is provided. And the jwt.io Debugger says, that the generated Tokens are valid. But it seems that the JWT Middleware doesn't accept my Tokens, because my Router is never touched.

Checklist

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

Expected behaviour

The protected Router does his thing.

Actual behaviour

The protected Router is never touched and the JWT Middleware returns:

{
"message": "Unauthorized"
}

Steps to reproduce

Try to hit a protected Path with a RS256 JWT Bearer Token.

Working code to debug

I have the following Code in my App:

const ( algorithmRS256 = "RS256" )

e.Use(middleware.JWTWithConfig(middleware.JWTConfig{
	SigningKey:    config.Config.SignKey,
	SigningMethod: algorithmRS256,
	Skipper: func(c echo.Context) bool {
		if c.Path() == "/login" || c.Path() == "/signup" ||
			c.Request().Method == "OPTIONS" {
			return true
		}
		return false
	},
}))

When I print the SignKey to the Terminal it is populated and the Issuing of the Token should not be the Problem, cause I verified the Tokens with jwt.io

Version/commit

Just made a go get -u github.com/labstack/echo before posting this.

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