{"id":18298686,"url":"https://github.com/fusionauth/fusionauth-example-flask-portal","last_synced_at":"2025-08-01T20:38:53.869Z","repository":{"id":48898654,"uuid":"291790727","full_name":"FusionAuth/fusionauth-example-flask-portal","owner":"FusionAuth","description":"A user portal written in python/flask, using FusionAuth as the user data store","archived":false,"fork":false,"pushed_at":"2024-07-28T05:54:54.000Z","size":29,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-07-28T06:45:36.909Z","etag":null,"topics":["example","flask-portal","fusionauth","oauth2","pkce","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FusionAuth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-31T18:15:23.000Z","updated_at":"2024-07-28T05:54:57.000Z","dependencies_parsed_at":"2024-07-28T06:52:05.844Z","dependency_job_id":null,"html_url":"https://github.com/FusionAuth/fusionauth-example-flask-portal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-example-flask-portal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-example-flask-portal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-example-flask-portal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FusionAuth%2Ffusionauth-example-flask-portal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FusionAuth","download_url":"https://codeload.github.com/FusionAuth/fusionauth-example-flask-portal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223192687,"owners_count":17103564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["example","flask-portal","fusionauth","oauth2","pkce","python"],"created_at":"2024-11-05T15:06:42.701Z","updated_at":"2024-11-05T15:06:43.246Z","avatar_url":"https://github.com/FusionAuth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Flask user portal\n\nThis user portal allows you to read and update a user's registration.data field, which is an arbitrary key value store in FusionAuth.\n\nYou can read the full blog post here: https://fusionauth.io/blog/2020/09/10/building-profile-portal-with-flask-oauth-apis\n\nThis application will use an OAuth Authorization Code workflow and the PKCE extension to log users in and store the access token securely. PKCE stands for Proof Key for Code Exchange, and is often pronounced “pixie”.\n\nWe will use Requests-OAuthlib to handle all our OAuth2.0 authorization requests. This library utilizes the Python Requests and OAuthlib libraries to provide an easy-to-use Python interface for building OAuth1 and OAuth2 clients.\nYou can read the docs for more information here: https://requests-oauthlib.readthedocs.io/en/latest/\n\nRequests-OAuthlib library does not support pkce. As a workaround, we will append our pkce parameters to the authorization requests generated by\nthe library. We will need to do it a couple of times, first when we are sending an authorization code request and second during the code\nexchange process. Other than that, our requirements for this application are being met by this library.\n## Prerequisites\n\nYou need to make sure FusionAuth is running and that you have python3/pip3 available. \n\n## Setup\n\n* `python3 -m venv venv`\n* `. venv/bin/activate`\n* `pip3 install Flask`\n* `pip3 install requests_oauthlib`\n* `pip3 install fusionauth-client`\n* `pip3 install pkce`\n* `pip3 install requests`\n* create an application in FusionAuth:\n  * Set the redirect url to `http://localhost:5000/callback`\n  * Set the logout url to `http://localhost:5000`\n  * Follow form creation as documented here: https://fusionauth.io/blog/2020/08/27/advanced-registration-form and note the form id\n  * Create an API key\n* `cp samplesettings.py settings.py`\n* Update `settings.py` with your values\n\n## Running \nTo run this:\n\n`OAUTHLIB_INSECURE_TRANSPORT=1 FLASK_APP=oauth.py python3 -m flask run`\n\nVisit the application at http://localhost:5000\n\n## To leave venv\n\nrun `deactivate` to leave the venv environment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusionauth%2Ffusionauth-example-flask-portal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffusionauth%2Ffusionauth-example-flask-portal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusionauth%2Ffusionauth-example-flask-portal/lists"}