cdbattags / lua-resty-jwt

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

JWE Signing lua entry thread aborted: runtime error: unknown reason #32

Closed ernestclyde closed 3 years ago

ernestclyde commented 4 years ago

Hello currently i am using openresty 1.15.8.3 and trying to sign JWE based on the example of https://github.com/cdbattags/lua-resty-jwt#sign-jwe

i got this error when signing JWE

coroutine 0: [C]: in function 'error' /usr/local/openresty/site/lualib/resty/jwt.lua:202: in function 'derive_keys' /usr/local/openresty/site/lualib/resty/jwt.lua:407: in function 'sign' /app/clients/api/login.lua:84: in main chunk, client: xxx, server: xxx, request: "POST /api/login HTTP/1.1", host: "xxx", referrer: "xxx" 2020/05/12 09:05:57 [error] 23380#23380: *1 failed to load external Lua file "/app/clients/api/login.lua": /app/clients/api/login.lua:87: '}' expected near '=', client: xxx, server: xxx: "POST /api/login HTTP/1.1", host: "xxx", referrer: "xxx"

cdbattags commented 4 years ago

have a code snippet? lua block to test?

cdbattags commented 4 years ago

@ernestclyde any update here? If not, I'll have to close this.

LasithaPrabodha commented 3 years ago

@cdbattags I also get this error.

runtime error: unknown reason
stack traceback:
coroutine 0:
        [C]: in function 'error'
        /usr/local/lib/lua/lua-resty-jwt/lib/resty/jwt.lua:206: in function 'derive_keys'
        /usr/local/lib/lua/lua-resty-jwt/lib/resty/jwt.lua:441: in function 'sign'
        content_by_lua(nginx.conf:64):5: in main chunk, client: 127.0.0.1, server: localhost, request: "GET /sign HTTP/1.1", host: "localhost"

code

                        local cjson = require "cjson"
                        local jwt = require "resty.jwt"

                        local jwt_token = jwt:sign(
                                "lua-resty-jwt",
                                {
                                        header={typ="JWE", alg="dir", enc="A128CBC-HS256"},
                                        payload={foo="bar"}
                                }
                        )
                        ngx.say(jwt_token)

version: v0.2.2

cdbattags commented 3 years ago

Feel free to go ahead and add a test to the t directory!

cdbattags commented 3 years ago

A128CBC-HS256 was added for version 0.2.3! Feel free to check it out!