I'm trying to make a multipage web app that uses json web tokens for authentication. Using JWTs for single page apps is fairly trivial as you just set the headers on an XHR and send it off, but setting the headers for regular browser requests seems somewhat more difficult.
It would be possible to use query strings here, but it'd be better to use headers.
Short answer. No. Not for standard anchor links or form submit behaviour. This is a long standing "issue" with traditional multipage apps. I use quotes around "issue" because...
Long Answer. There are likely other ways to achieve your goal.
- Use hidden form fields if your doing a form submit style post and redirect.
- Do something clever with an ajax call that post to resource that response back with a success message object with a route to navigate to on success (and maybe one for failure). Just as an example. You could probably take advantage of server repsonse codes (http 302) etc.