Closed l4u532 closed 10 months ago
Tests currently fail because
Run docker/login-action@v2 Error: Username and password required
Issue raised: https://github.com/OpenBeta/openbeta-graphql/issues/372
Hey, I'm just spitballing here, I'm not fully aware of the requirements for this and I'm not even familiar with the auth system currently implemented: wouldn't it be easier if we just had a "superuser" (which is an actual user) rather than having many checks/ifs/elses checking for "god mode"? Instead it would just "force" login with this previously set user that has access to everything. The logic would be kept tight and less sparse. Of course this user could be activated by setting that env, this bit would not change much. I hope my point is not far from reality 😅
Hey, I'm just spitballing here, I'm not fully aware of the requirements for this and I'm not even familiar with the auth system currently implemented:
wouldn't it be easier if we just had a "superuser" (which is an actual user) rather than having many checks/ifs/elses checking for "god mode"? Instead it would just "force" login with this previously set user that has access to everything. The logic would be kept tight and less sparse.
Of course this user could be activated by setting that env, this bit would not change much.
I hope my point is not far from reality 😅
When querying the database via the GraphQL endpoint, some kind of Auth is required (Token). I assume re-wiring that logic would be equally complex? Anyway, would he happy to see a more parsimonious solution to this -- once we get this baby here merged ;)
Background:
I'm all for improving the developer experience. My only concern is the current PR introducing more complexity to the auth layer. How about
One of the pros of this approach is the auth code path in test or prod is nearly identical. A con is we need to include the right data in the JWT payload.
What are your thoughts?
@vnugent Checks are passing ✅. Regarding your proposal: I am a bit on the fence, since I'd have to start over 😄 but I do agree that the auth layer should be as clean as possible. I'll try my luck next week. Thanks for the suggestion.
Wasn't the original PR doing that? Bypassing the JWT Validation with a static user?
I thought that did not work and didn't get merged. Also I don't like the idea of having to statically include a JWT in every request I do against localhost.
How about the following:
BYPASS_AUTH=true
(I don't like non speaking names like god mode).What do you think?
To help @l4u532 move forward perhaps we can address two issues at hand separately:
@vnugent reworked it according to @Silthus proposal. What do you think?
@l4u532 Thanks! Can you add a follow up PR, documenting the new server start cmd?
Hey there, since the conversation in #286 had died down, I wanted to continue the work of @bradleyDean, since it is tremendously helpful for local db development.
What was that again?
yarn serve-dev
I added a switch in
permissions.ts
to the original code, since otherwise queries/mutations via GraphQL would return unauthorised.