-
Notifications
You must be signed in to change notification settings - Fork 7
feat: Add ability to set auth header in admin api request #47
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
base: main
Are you sure you want to change the base?
Conversation
|
@davidnuescheler , @fkakatie , I am using the |
<div> | ||
<label for="headers-container">Headers</label> | ||
<div id="headers-container"> | ||
<div id="auth-token-header" class="header"> | ||
<input type="text" class="header-name" placeholder="Header name" required="" value="x-auth-token"> | ||
<input type="text" class="header-value" placeholder="Header value" required=""> | ||
<button type="button" class="remove-header" aria-label="Delete header"> | ||
<span class="icon icon-trash-delete-bin"></span> | ||
</button> | ||
</div> | ||
</div> | ||
<button type="button" id="add-header" class="button">Add Header</button> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these part of the form submission? shouldn't they be inside the form, not after it (and the submit button)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are part of the form submission and get appended to the headers. There are 2 forms on this page - admin form and the body form, and since the headers get sent on submission on either of them, associating them with one particular form did not seem correct so I kept them out of both.
@fkakatie , I don't have merge rights in the repo. Could you please help in getting this merged? |
the auth token should be added via sidekick, so i don't think that this is the right way of doing this... i think currently it is probably hard to discover, but you should be able to just log into a sidekick (on |
Thanks @davidnuescheler . I am trying to figure out how to get the access token available from the sidekick login. Meanwhile if you have some guidance on how to do that, please let me know. |
@sdmcraft As David alluded to, the Sidekick will handle this for you. So there is no need to directly access the token so long as you are logged into the sidekick on same org you are trying to make admin request to. |
Ok, so looks like here's the flow that works:
|
For better discoverability of the flow to add auth header, I can add a "Login" button on the page somewhere. When clicked, the user is prompted to login via https://admin.hlx.page/login/org/site/main . Post this admin api requests from the admin tool would automatically get the auth header added (and not be required to be explicitly added as originally proposed in this PR). @davidnuescheler do you think this would be useful? |
yes, we have an error message in the log viewer that links them to their project asking them to sign into the sidekick.
Just logging in to admin.hlx.page might not be enough, logging into the sidekick is what would work. |
@amol-anand , where can I see the log viewer? Currently, the tool only reports as below |
Test URLs: