Skip to content
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

TypeError: auth.apply is not a function #46

Open
lo3ty opened this issue Aug 26, 2015 · 3 comments
Open

TypeError: auth.apply is not a function #46

lo3ty opened this issue Aug 26, 2015 · 3 comments

Comments

@lo3ty
Copy link

lo3ty commented Aug 26, 2015

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

@Jonnx
Copy link

Jonnx commented Nov 12, 2015

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

@brianjorden
Copy link

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.

@CLOUGH
Copy link

CLOUGH commented Aug 24, 2016

Thanks @lo3ty that wored for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants