Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Swagger UI curl command lacks "Token" #2371

Open
KlausGPaul opened this issue Feb 23, 2023 · 1 comment
Open

Swagger UI curl command lacks "Token" #2371

KlausGPaul opened this issue Feb 23, 2023 · 1 comment
Labels
bug Something isn't working client action needed This ticket is blocked until additional information or a decision is provided by the client OSH_JIRA

Comments

@KlausGPaul
Copy link

Overview

When executing an API command, a curl command line is displayed which suggests it could be used on a client's machine. This is not the case, as the Authentication field is missing the leading "Token " text.

Expected Behavior

The documentation should be self-explanatory. If need be, a comment explaining what needs to be done could be added.

Actual Behavior

When copy & pasting the command line such as

curl -X GET "https://opensupplyhub.org/api/facilities/?countries=DE" -H "accept: application/json" -H "Authorization: <token>"

Clients get a misleading error message

{
  "detail":"Authentication credentials were not provided."
}

usually just after they created such a token, making them wonder what they have done.

That page is generally the first page for new API clients to visit after they generated a token.

Steps to Reproduce

Select "Try it out" on https://opensupplyhub.org/api/docs

Demo

N/A

Additional context

This caused questions before, and again today, and causes client dissatisfaction and extra work.

@KlausGPaul KlausGPaul added bug Something isn't working client action needed This ticket is blocked until additional information or a decision is provided by the client labels Feb 23, 2023
@jwalgran
Copy link
Contributor

I confirmed that the current examples will include the "Token prefix if it was included in the authorization.

I do not know specifically how we could inject some custom Javascript into the automatically generated Swagger UI so that we can helpfully guide users into making sure the API key field has the required prefix, but I think with some research we could find a way.

Screenshot 2023-02-23 at 9 13 29 AM

Screenshot 2023-02-23 at 9 13 53 AM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working client action needed This ticket is blocked until additional information or a decision is provided by the client OSH_JIRA
Projects
None yet
Development

No branches or pull requests

3 participants