Code Monkey home page Code Monkey logo

Comments (6)

vishr avatar vishr commented on May 12, 2024

@axdg Can you please look at it?

from echox.

axdg avatar axdg commented on May 12, 2024

Sure; @transtone, I'm not able to replicate the problem - do you think that you could provide a snippet of your terminal IO so that I can figure out what's happening.

from echox.

transtone avatar transtone commented on May 12, 2024

this is what I do, and all my system(linux/windows) got the same problem:

  1. # go get github.com/labstack/echo
    # go get github.com/dgrijalva/jwt-go
  2. # git clone https://github.com/labstack/echox.git
    # cd echox/recipe/jwt-authentication
  3. # go run main.go
    # curl localhost:1323/restricted -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0NTgwOTY1NjAsInVzZXJOYW1lIjoidHJhbnN0b25lIn0.2S-cvb_0TwCeWbX6weP9yhXgb3n2Ck_hbTfUEIKwzOw"

it gets nothing.

what's wrong with these steps?

curl -D - localhost:1323/restricted -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0NTgwOTY1NjAsInVzZXJOYW1lIjoidHJhbnN0b25lIn0.2S-cvb_0TwCeWbX6weP9yhXgb3n2Ck_hbTfUEIKwzOw"

it get:

HTTP/1.1 200 OK
Vary: Accept-Encoding
Vary: Origin
Date: Sun, 13 Mar 2016 03:25:17 GMT
Content-Length: 0
Content-Type: text/plain; charset=utf-8

when comment the JWTAuth line, it get:

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Vary: Accept-Encoding
Vary: Origin
Date: Sun, 13 Mar 2016 03:30:19 GMT
Content-Length: 25

Access granted with JWT.

from echox.

muei avatar muei commented on May 12, 2024

+1

from echox.

transtone avatar transtone commented on May 12, 2024

it seems the JWTAuth func have a problem:
https://github.com/labstack/echox/blob/master/recipe/jwt-authentication/main.go#L40

                if err == nil && t.Valid {
                    // Store token claims in echo.Context
                    c.Set("claims", t.Claims)
                    return nil
                }

it should be return next.Handle(c) not return nil

from echox.

vishr avatar vishr commented on May 12, 2024

@transtone Looks like it did not upgrade properly to v2. I will fix it.

from echox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.