sorry to be so offtopic but does anybody know of a method to get back into an instagram account..? I was stupid forgot the login password. I would love any assistance you can offer me.
@Oakley Shiloh I really appreciate your reply. I found the site through google and im trying it out now. I see it takes a while so I will get back to you later when my account password hopefully is recovered.
I really like your tutorials. I have worked with sql databases for over 20 years and normally don't use sqlalchemy. It is a good program but it is easier for me to use sql. I know you can execute sql from sqlalchemy, but why bother if you don't use the rest of the features? I usually start by creating a class for each table and use sql to do crud operations. Most tutorials for flask-login are 80% sqlalchemy and building an entire authorization system. I already have that. All I needed was the login/logout & session information. Yours is the only tutorial I saw that did not spend most of the time building an entire auth system. As always, your video was short, to the point, and easy to follow.
im stuck at 6:37. my application is call finalProject and i run from finalProject import db but got the error: ImportError: No module named flask_login any help would be appreciated
Awesome :) I've noticed that django does a lot of things automatically vs flask... Flask is the perfect starting point as you will understand more of the hidden django operations :) well explained video 👍
How is user_id in the load_user function not equal to none?? Because when i put the int() before the user_id it gives me a ValueError invalid literal for int() with base 10: 'None''
Flask-Login stores the user ID in a cookie. When it reads that cookie, it takes the user ID and calls the query in the user_loader to find the user associated with that cookie.
In the video, and I am not sure if you will address this in further videos yet, when you are calling a list of users for the usernames what do you do in that case? Is there a video that covers pulling names from this list rather than just the one name? Or do you have to list each of the usernames?
Thanks for an amazing video. Do you think Flask Login (alongside with Flask-security) can be used with Flask Blueprints? What I'm concerned about is is there a way how to define the User and the db outside of the app.py file, so that everything is a bit more neatly organized?
Thans for the answer. However, I constantly run into ImportErrors when using Flask-security in combination with Blueprints, so I decided to go a different way. Thanks anyway!
I'm thinking of ways to make the playlists more organized here. There are limits to UA-cam playlists, so I may have to put together something on my website.
Hi, great video. One question, does Flask-Login make the session secure? Or what to add to make the session secure? If i use a form, is it then to apply Csrf protection to the form?
In your tutorials you put a lot of code in the flask views file. In a more production ready app would most of the computation be done by functions saved in a separate module?
Yeah, it's easier to have all the code in one file for my UA-cam videos. For production apps, you'd be better off separating them if you have a lot of code. I have a video on one way to do it here: ua-cam.com/video/_5OXmXvkU_E/v-deo.html There are plenty of other ways to do it though.
Great tutorial, My only question is there a cleaner way to apply 'login_required' on multiple methods or i have to decorate every method that requires user login??
the official documentation argues we MUST include the 'next' algo, see the following, after successful login next = flask.request.args.get('next') if not is_safe_url(next): return flask.abort(400) could you please explain why is it necessary? Thanks. here is the reference: flask-login.readthedocs.io/en/latest/#flask_login.LoginManager.user_loader
The UserMixin makes it easy for Flask Login to know what represents a user. If you don't have that then you'll need to create your own methods so you can use login_user.
I have an external database that I am connected through pypyodcs, would I need to still need to make a user class in the same way you have, as all I want to do is check if the user is logged in, if they are get them to enter there credentials and check against the mssql database.
Yeah, you'll need a user class and a user loader. This is so Flask-Login can map sessions to actual users in your database. It doesn't have to be like a SQLAlchemy class though, where it has all the table information.
ah ok think I got you. So you mean within my user class, I can use a try-except to connect to my mssql db using pypyodbc connector, then from there I can use those credentials to check if the user is logged in or not, am I on the right track? Also is there a way to obtain the user details if logged in, as I need to pass the user details in a post request to an api. Thanks for the help
You don't necessarily need to connect to your database using the user class directly. The user class should just represent a user. The user loader should be a little more direct to your database though, so you can query the database for a particular user given an ID.
Ok can I use the email address as an id? As I don't have any other id in the user table, well there is but it is a crazy long hexnumber I think! I didn't create the table! I'm still a noob, the head developer at my work did
When I try to display user username I get info that I'm anonymous user that has no attribute as username. Also I get warning "Unauthorized" when I try to enter a page after logging in
Thank you so much for responding. Yes. I have my code in an __init__.py file. ideone.com/JcZFrQ And here is my requirements.txt file, which I have installed PIP packages using virtualenv from. pastebin.com/rPpprzHk The error occurs at the line "return User.query.get(int(user_id))"
Join my free course on the basics of Flask-SQLAlchemy: prettyprinted.com/flasksql
why @login_maneger.user_loader not working now
sorry to be so offtopic but does anybody know of a method to get back into an instagram account..?
I was stupid forgot the login password. I would love any assistance you can offer me.
@Caleb Alfred instablaster ;)
@Oakley Shiloh I really appreciate your reply. I found the site through google and im trying it out now.
I see it takes a while so I will get back to you later when my account password hopefully is recovered.
@Oakley Shiloh It did the trick and I actually got access to my account again. I'm so happy!
Thank you so much, you saved my account :D
This channel is priceless.
I'm glad you like my channel! Thanks for watching.
I really like your tutorials. I have worked with sql databases for over 20 years and normally don't use sqlalchemy. It is a good program but it is easier for me to use sql. I know you can execute sql from sqlalchemy, but why bother if you don't use the rest of the features? I usually start by creating a class for each table and use sql to do crud operations. Most tutorials for flask-login are 80% sqlalchemy and building an entire authorization system. I already have that. All I needed was the login/logout & session information. Yours is the only tutorial I saw that did not spend most of the time building an entire auth system. As always, your video was short, to the point, and easy to follow.
your flask tutorials are lit bro . thanks a lot
your type speed is incredible. good video!
im stuck at 6:37. my application is call finalProject and i run from finalProject import db but got the error:
ImportError: No module named flask_login
any help would be appreciated
Did you install flask login using pip?
pip install flask-login
Pretty Printed yes, what was wrong was that I needed to get the latest version of pip
what if i have a environment databse url , then what to use in plde of db.model in user class
How can i avoid the access to a url from my site in reactjs using an api with this login?
Awesome :) I've noticed that django does a lot of things automatically vs flask... Flask is the perfect starting point as you will understand more of the hidden django operations :) well explained video 👍
yes, me to. but django is a full stack framework and flask only a minimalist. i would be great if flask has the same database skill :)
Yeah agree:) I really do like django:)
i tested it yesterday, firstly i think it is better than flask. but with flask classy and other extension it is way easier...
Oh yeah I agree:) django is awesome, the built in functionality is awesome (admin, database and validation functionality)
i prefer flask now. i saw SQLAlchemy and many other which are very good! :D
what is "load_user" used for?
you declared but did not use it
Thanks. really high quality video.
awesome, as always!
Thanks for watching!
How is user_id in the load_user function not equal to none?? Because when i put the int() before the user_id it gives me a ValueError invalid literal for int() with base 10: 'None''
please how do i use the flask login without sqlAlchemy , but with the the traditional database ;
HELP ME
the link for the code takes me to a site with a 404 error
A year later, it STILL gives a 404 error... apparently, no longer maintained :/
Thanks for watching everyone. Check out prettyprinted.com for Flask courses.
is your website build with flask?
It isn't, but the next version of it will be.
How to customise and put `username` instead of `id` in get_id() method inside flask_login
I cant understand the pourpose of @login_manager.user_loader please make me understand
Flask-Login stores the user ID in a cookie. When it reads that cookie, it takes the user ID and calls the query in the user_loader to find the user associated with that cookie.
In the video, and I am not sure if you will address this in further videos yet, when you are calling a list of users for the usernames what do you do in that case? Is there a video that covers pulling names from this list rather than just the one name? Or do you have to list each of the usernames?
I'm not sure what you mean. Why would you want to use a list of users for login functionality. it should only be one user at a time.
Wow you are amazing! Thanks for your videos, You really help me
Thanks for an amazing video. Do you think Flask Login (alongside with Flask-security) can be used with Flask Blueprints? What I'm concerned about is is there a way how to define the User and the db outside of the app.py file, so that everything is a bit more neatly organized?
Yes, you can. Regardless of how you organize your app, you'll be able to use Flask-Login.
Thans for the answer. However, I constantly run into ImportErrors when using Flask-security in combination with Blueprints, so I decided to go a different way. Thanks anyway!
Is it possible to create a Playlist for all your Flask-Login related stuff? And how should we follow up, it would be much appreciated!
I'm thinking of ways to make the playlists more organized here. There are limits to UA-cam playlists, so I may have to put together something on my website.
great tutorial, but how about having captions? hard to follow - bit fast :(
Hi, great video. One question, does Flask-Login make the session secure? Or what to add to make the session secure? If i use a form, is it then to apply Csrf protection to the form?
The session is secure, but the CSRF token is something different. You'll have to add that to the form yourself.
In your tutorials you put a lot of code in the flask views file. In a more production ready app would most of the computation be done by functions saved in a separate module?
Yeah, it's easier to have all the code in one file for my UA-cam videos. For production apps, you'd be better off separating them if you have a lot of code. I have a video on one way to do it here: ua-cam.com/video/_5OXmXvkU_E/v-deo.html
There are plenty of other ways to do it though.
Great video! Thank you
Great tutorial, My only question is there a cleaner way to apply 'login_required' on multiple methods or i have to decorate every method that requires user login??
Yes, you can use class-based views and then apply the decorator once in the class. See here: flask.pocoo.org/docs/0.12/views/
thanks for the solution, i have been searching this for long time
the official documentation argues we MUST include the 'next' algo, see the following, after successful login
next = flask.request.args.get('next')
if not is_safe_url(next):
return flask.abort(400)
could you please explain why is it necessary? Thanks.
here is the reference: flask-login.readthedocs.io/en/latest/#flask_login.LoginManager.user_loader
Thank you ,for the awesome tutorial .
You're welcome!
If we not inharrit from usermixin then we can use login_user (user) and logout_user () function or not?
The UserMixin makes it easy for Flask Login to know what represents a user. If you don't have that then you'll need to create your own methods so you can use login_user.
please do a tutorial on flask-login with mongodb
great tutorial! thanks you sir
How to use Flask-login using pymongo? Do you have any videos on it?
You'll have to write query in the user load to get your user with pymongo. I don't have any videos on it, but perhaps I'll create one.
I have an external database that I am connected through pypyodcs, would I need to still need to make a user class in the same way you have, as all I want to do is check if the user is logged in, if they are get them to enter there credentials and check against the mssql database.
Yeah, you'll need a user class and a user loader. This is so Flask-Login can map sessions to actual users in your database. It doesn't have to be like a SQLAlchemy class though, where it has all the table information.
ah ok think I got you. So you mean within my user class, I can use a try-except to connect to my mssql db using pypyodbc connector, then from there I can use those credentials to check if the user is logged in or not, am I on the right track? Also is there a way to obtain the user details if logged in, as I need to pass the user details in a post request to an api. Thanks for the help
You don't necessarily need to connect to your database using the user class directly. The user class should just represent a user. The user loader should be a little more direct to your database though, so you can query the database for a particular user given an ID.
Ok can I use the email address as an id? As I don't have any other id in the user table, well there is but it is a crazy long hexnumber I think! I didn't create the table! I'm still a noob, the head developer at my work did
Yeah, an email address is fine as an ID. The ID just has to be unique.
How can I handle the "Unauthorized" Page by myself ? For example, I want to custom the words. Thank you.
login_manager.unauthorized_handler
USER_UNAUTHENTICATED_ENDPOINT configuration value.
What was the program you used for running Python script, the orange icon one?
It's Bash on Windows so you can use Ubuntu inside of Windows.
When I try to display user username I get info that I'm anonymous user that has no attribute as username.
Also I get warning "Unauthorized" when I try to enter a page after logging in
Check your cookies. Is the app creating one when you log in?
Is it doing anything other than session handling? I dont find flask-login very useful.
Just session handling. Check out Flask-User or Flask-Security if you want more.
Nice tutorial, congrats!!!
Thanks for watching!
Thank you!
love the vids! When is the next one due out :)
Thanks!
i plan on recording the next video today. I lost my voice last week.
thank you so much
how to ude materialize.css with flask or django?????
There's a Flask plugin called Flask-Materialize. It's similar to Flask-Bootstrap, which I have videos on.
Pretty Printed thank you ..you are great...any django videos in futur??
Yeah, I'm planning on making them soon. I want to finish up a Flask course first though.
Pretty Printed thank you😀😀
Awesome. You got Thumbs up and new subscriber.
Thanks, I appreciate it!
Are you on ubuntu or windows? I'm confused.
Both! You can use Ubuntu on Windows.
Thank you! You are amazing!
You're welcome! Thanks for watching.
I get "Class "User" has no "query" member". I have all of the the necessary packages.
Do you have the db.Model in the class declaration?
class User(UserMixin, db.Model)
Thank you so much for responding.
Yes. I have my code in an __init__.py file.
ideone.com/JcZFrQ
And here is my requirements.txt file, which I have installed PIP packages using virtualenv from.
pastebin.com/rPpprzHk
The error occurs at the line "return User.query.get(int(user_id))"
Nevermind. It seems to be working despite this error. I'm not sure why I'm getting the error but it is not a runtime error.
Gold :)
thank you anthony
You're welcome.
sqlite:/// not sqlite:////
u lost me after 2 minutes...