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

kreut's avatar
Level 2

Post to my Laravel application

Hi,

I'm developing an SPA (Laravel and VUE) and would like a third party to pass back a post request to my application. In particular, a third party webpage will be presented in an iframe where I'll pass my Laravel JWT via a parameter in the URL (www.some_other_domain.com?jwt=fjisoilLLFL). I'd like it to then add data to the JWT and then pass it back to my application via a cURL post request. I know that the JWT "contains" the authenticated user in it but I'm not seeing how to set up the Post request so that Laravel can consume the JWT and verify that it's an authenticated user.

Any help in getting started would be appreciated.

Thanks so much!

0 likes
2 replies
litvinjuan's avatar

As I understand, you want a post route that is authenticated through your JWT so the iframe can make a request to your application.

Disclaimer: I suggest you avoid this approach if possible

In that case, you simply need to add a post route as you would normally do. Nothing really changes. Because a request authenticated through JWT is stateless, it doesn't care that it's coming from the same browser or anything, just that the token is valid in this case.

Simply add an auth middleware with the correct guard

kreut's avatar
Level 2

Thanks for quick reply!

2 follow up questions:

  1. I must be misunderstanding something basic because I’m still not seeing how the request is going to contain the jwt. To be more specific, if I submit a form via vanilla PHP with an input field having name=“age” then the request will contain age as a key in $_POST. What is the key that Laravel checks in an SPA to ensure a valid JWT?

  2. More importantly, why avoid this approach?

Cheers,

Eric

Please or to participate in this conversation.