swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

"raw" link doesn't respect api_key

Open webron opened this issue 12 years ago • 6 comments

If you input an api_key in the UI, it is not used when clicking the 'raw' link of an item and gives only partial results.

webron avatar Sep 19 '14 16:09 webron

I wasn't sure if it was me or a bug. I've just been dabbling in this area as well. I have my own "key" that I'm trying to inject as a query parameter:

window.authorizations.add("key", new ApiKeyAuthorization("access_token", currentToken, "query"));

But the token wouldn't show up in any of the requests until I added a couple of lines of code. In swagger-client.js I re-applied the authorizations just before executing the requests:

    ...
    //Apply authorizations
    var e = (typeof window !== 'undefined' ? window : exports);
    e.authorizations.apply(obj);

    new SwaggerHttp().execute(obj);
}

Is this a valid issue or am I doing something wrong?

watnotte avatar Sep 19 '14 16:09 watnotte

@watnotte - that's actually not related to the topic. What you're looking for is addition authorization to API calls whereas I'm talking about the authorization to the API documentation.

As for your case, it should work with

window.authorizations.add("key", new ApiKeyAuthorization("access_token", currentToken, "query"));

only, but if it doesn't, feel free to open a separate issue on it.

webron avatar Sep 19 '14 17:09 webron

Sorry, misunderstood. I'll open a separate case. Thanks.

watnotte avatar Sep 19 '14 17:09 watnotte

since 2.1 doesn't show the link by default, I'm guessing this might not need to be supported.

fehguy avatar Jan 28 '15 21:01 fehguy

I believe SwaggerJS should provide the complete link in the model.

mohsen1 avatar Mar 06 '15 23:03 mohsen1

The Raw link is gone. We're converting all old specs to 2.0 before rendering

mohsen1 avatar Mar 26 '15 21:03 mohsen1