BTBurke / caddy-jwt

JWT middleware for the Caddy server
MIT License
113 stars 40 forks source link

JWT signed with H256 results in a 401 #47

Closed rochdev closed 5 years ago

rochdev commented 5 years ago

I cannot get the http.jwt plugin to work with a JWT signed with H256. It always results in a 401 error.

What I've tried:

My configuration:

<public_domain> {
  import ssl

  proxy / http://<internal_address>

  jwt {
    path /
    except /favicon.ico

    allow group Admin

    token_source cookie organizr_token_<uuid>
    secret /etc/secrets/app.txt
  }
}

At this point I really don't know what else to try. It seems that no matter what I do the request is rejected with a 401. Interestingly enough, the plugin seems to work if I pair it with the http.login plugin and Google OAuth, but not with a JWT alone.

BTBurke commented 5 years ago

It's hard to diagnose without having access to the token and key, but off the top of my head try a couple things:

Hopefully that should narrow down the source of the problem.

rochdev commented 5 years ago

This was caused by my Caddy image being too old and not having the token_source option. Updating the plugin solved the issue.

BTBurke commented 5 years ago

Great, hope it works out for you.