Swaggervel icon indicating copy to clipboard operation
Swaggervel copied to clipboard

TypeError: auth.apply is not a function

Open lo3ty opened this issue 9 years ago • 3 comments

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

lo3ty avatar Aug 26 '15 12:08 lo3ty

Ran into the same issue. The line 67 change fixes the problem. Thanks @lo3ty.

Jonnx avatar Nov 12 '15 14:11 Jonnx

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.

brianjorden avatar Jun 09 '16 14:06 brianjorden

Thanks @lo3ty that wored for me

CLOUGH avatar Aug 24 '16 18:08 CLOUGH