FusionAuth Python Flask Example
This example demonstrates how to integrate FusionAuth with a Python Flask application using OAuth 2.0. It includes features such as login, displaying user profile information, and logout functionality.
Prerequisites
- Python 3.x
- FusionAuth installed and configured (either on your local machine or using the cloud version)
Installation
- Clone the repository:
git clone https://github.com/rainleander/fusionauth-python-flask-example.git
cd fusionauth-python-flask-example- Install the required Python libraries:
pip install flask requests- Configure your FusionAuth credentials:
Open app.py and replace the following placeholders with the appropriate values from your FusionAuth instance:
'your_client_id''your_client_secret''https://your_fusionauth_url'
Make sure to replace 'your_secret_key' with a secure secret key for Flask.
- Run the application:
python app.py- Test the application:
Open your browser and navigate to http://localhost:5000. You should see a "Login with FusionAuth" link. Click on it to log in or register a new user. After successful authentication, you should be redirected to the profile page displaying the user's information.
Features
- Login with FusionAuth using OAuth 2.0
- Display user profile information
- Logout functionality
Contributing
Thank you for your interest in contributing to this project! We welcome and appreciate contributions from the community. Here's how you can get involved:
-
Fork the repository on GitHub by clicking the Fork button in the top right corner.
-
Clone the forked repository to your local machine:
git clone https://github.com/your_username/fusionauth-python-flask-example.git
cd fusionauth-python-flask-example- Create a new branch for your feature or bug fix:
git checkout -b your_feature_branch-
Make your changes in the new branch, and ensure that your code is well-organized, follows best practices, and includes comments where necessary.
-
Test your changes by running the application and ensuring everything works as expected.
-
Commit your changes with a clear and descriptive commit message:
git commit -m "Add a brief description of your changes"- Push your changes to your fork on GitHub:
git push origin your_feature_branch-
Create a pull request by navigating to your forked repository on GitHub, switching to your feature branch, and clicking the New Pull Request button.
-
Describe your changes in the pull request, and submit it.
After submitting your pull request, the project maintainers will review your changes. They may ask for additional changes or clarification before merging your changes. Remember to be patient and respectful during the review process, as the maintainers are volunteering their time to maintain this project.
Once again, thank you for your interest in contributing to the FusionAuth Python Flask Example. We look forward to collaborating with you and creating a better experience for the community!
License
This project is licensed under the Apache 2.0 License which means you can freely use, modify, distribute, and even commercially exploit the code, as long as you comply with the terms of the license and include the required copyright notice and disclaimers in any redistributed code.