Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bostinait's avatar

Dingo API and Ajax

I'm using Dingo API within my Laravel 5.1 app and I'm calling those routes via ajax (Vue-resource to be exact), however I'm experiencing an issue where I randomly get logged out and Dingo throws an authentication error.

If I call the same route directly in the browser all is fine but obviously that's no good to me.

I'm using JWT for the authentication layer.

Is there anything I need to consider when calling Dingo API routes via Ajax?

0 likes
2 replies
bobbybouwmann's avatar

I never had issues with it.. Maybe you are doing an unexpected redirect?

bostinait's avatar

No it just returns the standard "Failed to authenticate because of bad credentials or an invalid authorization header." error as the session containing the token is reset/lost

Please or to participate in this conversation.