[Flask] Flask-Security authentication in JS

Morgan Connolly connollymorg at gmail.com
Thu Sep 3 08:55:50 CEST 2015


Hey!

Thanks so much Corey, Scott, Christophe and Federico. I didn't know that
the browser would transmit cookies even if I used JavaScript, having never
worked on a dynamic website before. I just tried adding the JavaScript, and
without having to do any other work, it works how I want it to.

Once again, thank you all for your help!

Cheers



On Thu, Sep 3, 2015 at 4:58 AM, Federico Delgado Doyle <
fededelgado at outlook.com> wrote:

> Hi Morgan,
>
> I don't know about Flask-Security. But cookies should transmit regardless
> if the browser sent a post or get  or a javascript http request caused it.
>
> Have you actually seen that the cookie is not traveling when using jquery
> ajax or whatever you use?
>
> Cheers,
>
> Federico
>
> ------------------------------
> Date: Wed, 2 Sep 2015 17:40:31 +0530
> From: connollymorg at gmail.com
> To: flask at python.org
> Subject: [Flask] Flask-Security authentication in JS
>
>
> I have a Flask app that uses Flask-Security for authentication, which is
> storing authentication details in cookies on the client side. Currently, it
> is a static app rendered using Jinja templates, but now I want to implement
> some features which require access to protected resources dynamically via
> JavaScript.
>
> If I send a request using JavaScript to a URL, the cookies won't be
> transmitted. If I want to transmit the username/password with each request,
> I will have to pass it to Jinja in cleartext.
>
> I'm at a total loss here, and I do not know what to do. Can somebody point
> me in the right direction?
>
> Cheers
>
> _______________________________________________ Flask mailing list
> Flask at python.org https://mail.python.org/mailman/listinfo/flask
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20150903/8d0cf73f/attachment.html>


More information about the Flask mailing list