zmartzone / lua-resty-openidc

OpenID Connect Relying Party and OAuth 2.0 Resource Server implementation in Lua for NGINX / OpenResty
Apache License 2.0
976 stars 249 forks source link

Raw id_token #494

Closed mhaagens closed 1 year ago

mhaagens commented 1 year ago

Is there a way to get the raw id token and pass it along as a header?

bodewig commented 1 year ago

It is stored as enc_id_token in the session. If you enable storing it, that is.

mhaagens commented 1 year ago

Thanks for the swift reply. So it would go something like this?

  local opts = {
    ...,
    session_contents = {
      enc_id_token = true
    }
  }
  local res, err, target, session = require("resty.openidc").authenticate(opts)
  ngx.req.set_header("my-id-token-header", session.enc_id_token)

Can't seem to get anything from session.enc_id_token.

bodewig commented 1 year ago

should be session.data.enc_id_token. The session itself has a few more properties and the actual stored data is inside a table called data.