Swaggervel
Swaggervel copied to clipboard
TypeError: auth.apply is not a function
Hi there,
since the swagger-php update to v2.0 I got the following console notice when trying to add custom request headers through the swaggervel config file:
window.ApiKeyAuthorization is deprecated. Please use SwaggerClient.ApiKeyAuthorization.
Using window.authorizations is deprecated. Please use SwaggerUi.api.clientAuthorizations.add()
The UI loads as usal but if you try to send a request, a javascript error occurs:
TypeError: auth.apply is not a function
I figured that the view file needs to be updated. My solution:
in index.blade.php change Line 67 to:
swaggerApi.clientAuthorizations.add("{!!$requestKey!!}", new SwaggerClient.ApiKeyAuthorization("{!!$requestKey!!}", "{!!$requestValue!!}", "header"));
After this modification everything works just fine.
Would be great if you could implement this in the next revision.
Leonhard
Ran into the same issue. The line 67 change fixes the problem. Thanks @lo3ty.
Was having the exact same issue and the suggestion by @lo3ty worked perfectly. Removed the warnings and errors, seems to be exactly what is needed.
Thanks @lo3ty that wored for me