Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User authentication not working in mobile view #220

Closed
danchann opened this issue Nov 15, 2021 · 6 comments
Closed

User authentication not working in mobile view #220

danchann opened this issue Nov 15, 2021 · 6 comments

Comments

@danchann
Copy link

This is tested in the default flask-base instance.

Untitled.mov
@abhisuri97
Copy link
Contributor

I'm having a bit of difficulty reproducing this. Does authentication work normally if you're not in the mobile view?

@danchann
Copy link
Author

danchann commented Nov 17, 2021

I'm having a bit of difficulty reproducing this. Does authentication work normally if you're not in the mobile view?

Yes, authentication is working normally in desktop view but once switched to mobile view, the user becomes not authenticated.

Screen.Recording.2021-11-17.at.3.44.52.PM.mov

@danchann
Copy link
Author

I verified that the user is lost as soon as it is switched to mobile view
Desktop
image
Mobile
image

@danchann
Copy link
Author

danchann commented Nov 17, 2021

Looks like it's due to the session protection feature of flask-login.
The default protection in this repo is set to 'strong` mode, when the view is changed it seemed that the entire session is deleted.
See https://flask-login.readthedocs.io/en/latest/#session-protection

Solution:
Change the login_manager.session_protection to from "strong" to "basic".

login_manager.session_protection = 'strong'

@abhisuri97
Copy link
Contributor

Fixed. Could you pull again and see if that changes anything?

@danchann
Copy link
Author

Yep, it's working fine now. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants