Panel behind nginx/oauth2-proxy

I’ve been happily using panel with built-in oauth for quite some time. I’m now moving to placing panel behind a reverse proxy using nginx and a auth_request directive pointing to oauth2-proxy as an authenticator. In a similar way to that described here:

I’ve some existing panel code that checks a users email address using pn.config.authorize_callback. It would be nice to continue using this hook.

Is it possible to generate a header/cookie from nginx that would emulate an authenticated session so panel will automatically pick up user_info?

Or perhaps I should place an earlier hook on session starts up that builds up user_info from nginx forwarded tokens/user details? Alternatively, should I be subclassing OAuthLoginHandler to just pick up details from cookies directly with no redirects etc?