Skip to content
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

Preflight script in Laboratory when querying API #3612

Open
JonasWijkVolvoM opened this issue Dec 14, 2023 · 4 comments
Open

Preflight script in Laboratory when querying API #3612

JonasWijkVolvoM opened this issue Dec 14, 2023 · 4 comments
Labels
enhancement New feature or request that adds new things or value to Hive

Comments

@JonasWijkVolvoM
Copy link

Great that you added a way to call your own API in Laboratory

We (and probably many others) have a need to add headers for auth purposes. This can be done manually but it is very teadious to do every time plus and would be a blocker for using this feature among our devs on a wider scale forcing us to build and maintain our own Explorer.

Apollo have preflight script capability in their Explorer which can be used to automate this and make the DX good. It would be awesome if you could add something similar or another solution to this problem so that we can use Laboratory as our Explorer.

@jdolle
Copy link

jdolle commented Mar 15, 2024

This is important to my org as well.
It creates a lot of friction for our devs to log in and form the headers themselves, and then refresh the credentials every time they expire.

@n1ru4l
Copy link
Collaborator

n1ru4l commented Mar 20, 2024

Can you explain your optimal flow? What would be needed to retrieve the headers?

I assume that we could allow configuring an HTTP endpoint that is called with a secret configured within the targets settings, that will return the headers that should be attached to the request to be sent. In addition to that we could also provide information about the to be sent GraphQL Request (operation, variables, headers, etc.).
Would this be sufficient for your needs?

We hesitate to allow running custom JavaScript for preflight scripts as it introduces additional challenges for security and self-hosting.

@n1ru4l n1ru4l added the enhancement New feature or request that adds new things or value to Hive label Mar 20, 2024
@theguild-bot theguild-bot mentioned this issue Mar 20, 2024
92 tasks
@jdolle
Copy link

jdolle commented Mar 20, 2024

I'd like to have a username and password input appear in the lab when this feature is enabled.
We need a way for our developers to input the auth credentials in this flow. We have a number of accounts we use for testing that are all in different states.

Having a separate endpoint that is called to perform the authentication would be good.
For simplicity, it could be called before every operation to keep the headers refreshed, refresh every so often based on another setting, or ignore session expirations and rely on the user clicking a "login" button to refresh. Any of these would an acceptable developer experience.

@JonasWijkVolvoM
Copy link
Author

I think our use-case would be easiest to achieve with a Preflight script. I understand your concern but wouldn't it be up to the client whether or not they want to use the script option or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request that adds new things or value to Hive
Projects
None yet
Development

No branches or pull requests

3 participants