cdbattags / lua-resty-jwt

JWT For The Great Openresty
Apache License 2.0
146 stars 44 forks source link

Not sure how to use it #41

Closed AramshamFedaykin closed 3 years ago

AramshamFedaykin commented 3 years ago

Hello, I'm trying to use this in my nginx.tmpl, but not sure if I pass the good arguments.

Here's my conf : FROM k8s.gcr.io/ingress-nginx/controller:v0.40.2 RUN luarocks install lua-resty-jwt

nginx.tmpl snippet : local now = ngx.time() local jwt = { header = { typ = "JWT", alg = "RS256", kid = "${theKid}" }, payload = { iss = "nginx", env = "dev", sub = "sub", client_id = "client_id", exp = now + 60, } } local private_key = "${thePrivateKeyPemString}" local signed_jwt = require("resty.jwt").sign(private_key, jwt)

I tried this in my nginx localhost to have more debug, here's the msg : lua entry thread aborted: runtime error: ./lualib/resty\jwt.lua:517: attempt to index local 'jwt_obj' (a nil value)

What am I doing wrong ? Could you please help me ?

AramshamFedaykin commented 3 years ago

I went further by adding a new method in openidc.lua, which apparently has all necessary to call your lib. Don't understand what's missing though, but anyway. I also added some logs to see where's the prob, and I ended with this error in the RSASigner.new : no start line, the prob was with my private key which was concatenated...