Closed bodinsamuel closed 4 days ago
Would it make sense to factor this shared code out so future tweaks only change one file?
Yes and no, I am all for not repeating myself but sometimes it's handy.
In that case factorizing means a lot of ifs
and possible branching depending on the auth strategy. There are only a few lines that are strictly similar between all of them (e.g: this change, getting the provider/integrations). Basically, we could wrap the bootstrap of each auth and maybe the error handling.
sorry I fat fingered the close button. Meant to comment
This change looks very much like it belongs in a middleware. We would have to move the logCtx
in RequestLocals
but I am not sure it is possible.
This change looks very much like it belongs in a middleware. We would have to move the logCtx in RequestLocals but I am not sure it is possible.
This might, but requires a massive change to all auth controllers creating the logCtx beforehand and this makes the logic hard to follow (less self-contained) imo. I'll create a helper since both of you advocate for it
Cleaned with an helper and added some integrations tests 😇
Describe your changes
Fixes https://linear.app/nango/issue/NAN-1945/enforce-allowed-integrations-in-each-auth-endpoint