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

No mention of secret_key in docs, and UserMixin #391

Closed
3 tasks done
stemid opened this issue Jun 20, 2018 · 5 comments
Closed
3 tasks done

No mention of secret_key in docs, and UserMixin #391

stemid opened this issue Jun 20, 2018 · 5 comments

Comments

@stemid
Copy link

stemid commented Jun 20, 2018

Make sure these boxes are checked before submitting your issue--thank you!

  • Ensure you are using the latest PyPI release.
  • Read the CHANGES document thoroughly.
  • Provide a clear and simple set of steps to reproduce your issue for others.

The docs need to be made a bit clearer. I struggled for a long time before I realized that UserMixin is required in my User model. Even though I provided all those attributes and the get_id method that are mentioned in the docs myself.

It wasn't until I made my User model inherit from UserMixin and removed my own versions of those attributes that it started working.

And then I noticed I was missing secret_key because that isn't mentioned in the docs at all, the github README is much better than the docs but I didn't know that. The link to the docs is the first thing I clicked on.

@davidism
Copy link
Collaborator

The docs mention what methods are required and that UserMixin provides these. https://flask-login.readthedocs.io/en/latest/#your-user-class It's not required though, your methods should have worked assuming you implemented all the required ones.

SECRET_KEY isn't mentioned, but if you try to use the session without setting it Flask will tell you exactly what's wrong. It's also not required since you can do authentication without the session, although admittedly the session is the most common setup.

@alanhamlett
Copy link
Collaborator

Yep, @davidism is right on both counts.

@stemid closing this issue, but we love pull requests for docs improvements keeping in mind they should make the docs more clear, concise, and not too verbose 😄

@stemid
Copy link
Author

stemid commented Jun 21, 2018

I just realized that my mistake might have been to require a db.commit to set those attributes. I should have made them actual properties and called commit in the setter. That's probably why flask-login could never set any of them.

But the secret_key being implied is still wrong imo because people use flask-login to simplify flask login. Assuming they already know about flask session is wrong.

@alanhamlett
Copy link
Collaborator

Assuming they already know about flask session is wrong.

Re-opening until docs explain dependency on Flask's secret key being set.

@alanhamlett
Copy link
Collaborator

Docs added with #417, closing this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants