-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?]: Cookie created by yarn rw setup graphiql dbAuth
does not work in graphiql
#9702
Comments
@dthyresson Can I get your eyes on this one please? |
@Tobbe I'd like to put this as a p3 issue pending the rework of Dev Studio as user impersonation will be done differently -- but will need to retest. See: https://community.redwoodjs.com/t/redwood-studio-experimental/4771 |
We did also test this in Dev Studio and had the same issue. I’ll see if I can make some time to provide a repo and steps for that as well if it would be helpful. |
Ah, sorry, I should have been clear. There is currently a project close to completion to refactor all of Dev Studio. I figured that I would prefer to wait an fix the issue there (if still exists) vs current Redwood version. A reproduction is super helpful as I'll run it after the main other parts of Studio 2.0 are done. And if can confirm that at least if one pastes a valid header (and cookie) into the Playground manually, that impersonation works. We did see some cars where the browser kept the cookie around and thus gave a false indication of impersonating and not considering the cookie in the headers. Appreciate all your help here. |
Ah interesting, OK. So a reproduction with the experimental Redwood Studio would be useful now? |
@Tobbe Can we close this when "new studio" is out of experimental with her impersonation? |
I was going to ask for a repro with the new stuff, but wanted to get |
In v7, we are moving to Studio as a way of running Playground and user impersonation. I will remove or rework this setup command and confirm that v6 and before auth providers are still supported under v7 Studio. |
@cdubz Sorry this took longer than expected. But new Studio is now ready for you to try!
Verify that Studio starts up as expected, and that you're running version 11.1.1 or newer (Look at the top-left to see current version) Now add this to your [studio.graphiql]
authImpersonation.authProvider = "dbAuth"
authImpersonation.userId = 1 And then restart Studio, and hopefully impersonation should work for you |
Thanks for the info! I upgraded to canary, cleared out all my deps, and switched to Node 20 (there was a message somewhere in there about it) and followed the new steps but still got an error. It's a different error now though... Repo steps git checkout https://github.com/CascadePublicMedia/redwood-dbauth-cookie-issue.git
cd redwood-dbauth-cookie-issue
git switch canary
yarn install
yarn rw prisma migrate reset
I'm getting an error:
I get the same error if I try the workaround described in the initial report (logging in on the FE and removing the |
I did some fiddling in the node modules dir of my test env and found a clue to the issue -- the cookie name being checked for is If I change that header to So it looks like this bit is what needs to be adjusted: I would PR it but I'm not familiar enough with the code base to understand how to get the proper options context there. |
I think I did actually get it sorted here -- redwoodjs/studio/pull/16. Unrelated tangent -- the Studio dev instructions in the README were a little tough to work through. I didn't keep detailed notes but there is inconsistency in the node versions between Studio and the fixture project. And the test fixture resolution for |
That's strange. They're both using the exact same version of Redwood, so I wonder why you'd get that. If you could provide some reproduction steps that'd be great 🙏 |
What's not working?
The
yarn rw setup graphiql dbAuth -i $USER_ID
command generates a header that adds acookie
header to graphiql. When using the default output from that command queries executed in grqphiql return an error like below:The same error is thrown if we remove
cookie
from the headers.The workaround we have found now is that if we log in on the web side with the same user and remove the
cookie
header generated by the command we are able to make queries.How do we reproduce the bug?
Checkout example repo:
git checkout https://github.com/CascadePublicMedia/redwood-dbauth-cookie-issue.git
Migrate and seed database:
yarn rw prisma migrate reset
Generate Graphiql headers for User ID 1:
yarn rw setup graphiql dbAuth -i 1
Run dev server:
yarn rw dev
Navigate to http://localhost:8911/graphql
Attempt to run a command (should get the
getAuthenticationContext
error described).Log in from http://localhost:8910/login (user:
[email protected]
, pass:secret1
)Return to http://localhost:8911/graphql
Remove the
cookie
from the headers.Attempt a command (should work).
What's your environment? (If it applies)
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: