Closed siredwin closed 4 years ago
For now, I am foregoing the DataInjector middleware and using data := LayoutData(w, r)
directly in my views.
So far so good.
@siredwin The problem is simple. Authboss functions require the http.ResponseWriter's underlying type to be an authboss.ClientStateReadWriter
OR an authboss.UnderlyingResponseWriter
. If it is not one of those two things it will break.
Echo is one of few frameworks that replace the http.ResponseWriter from the http.Server
with its own thing. That means that the LoadClientStateMiddleware
has to be positioned AFTER Echo's replacement of the response writer, so that middlewares and handlers receive the Authboss RW, and not the Echo RW.
Abandoning "Authboss or Echo for Go-chi" is an excellent idea. Chi does not replace the response writer and so is an excellent companion to Authboss. We use Authboss + Chi for our projects.
Good luck!
I figured that much.
I think re-writing DataInjector into an echo middleware will be enough for now. It is working so far when I do it manually with data := LayoutData(w, r)
That also answers my question of if you chose chi
example for that reason.
I am using the
echo
Framework. I am at a point where I have to abandonAuthBoss
orEcho
forGo-chi
.I have found the cause of the problem though, it is the
dataInjector
. It somehow hijacks the context. TheLoadClientStateMiddleware
is just ok.I am going to try to modify it and see if it works. If you can think of anything else wrong with it, let me know.