Code Monkey home page Code Monkey logo

fusionauth-example-python-flask's Introduction

This repo is out of date and is archived. Check out an updated tutorial on using FusionAuth with Flask or the updated GitHub repository.

Example: Using Python3 with FusionAuth

This project contains an example project that illustrates using FusionAuth with Python3 Flask.

Prerequisites

You will need the following things properly installed on your computer.

  • Git: Presumably you already have this on your machine if you are looking at this project locally; if not, use your platform's package manager to install git, and git clone this repo.
  • Python3: Python3 can be installed via a variety of methods
  • pip3: The Python package manager should be installed as part of your Python install, but if not, use your Python install method's mechanism to install this package so that the Python dependencies can be pulled in.
  • Docker: For standing up FusionAuth from within a Docker container. (You can install it other ways, but for this example you'll need Docker.)

Installation

  • git clone https://github.com/FusionAuth/fusionauth-example-python-flask
  • cd fusionauth-example-python-flask
  • docker-compose up (this will block the current terminal)
  • python3 -m venv venv
  • . venv/bin/activate
  • pip3 install -r requirements.txt

FusionAuth Configuration

This example assumes that you will run FusionAuth from a Docker container. In the root of this project directory (next to this README) are two files a Docker compose file and an environment variables configuration file. Assuming you have Docker installed on your machine, a docker-compose up will bring FusionAuth up on your machine.

The FusionAuth configuration files also make use of a unique feature of FusionAuth, called Kickstart: when FusionAuth comes up for the first time, it will look at the Kickstart file and mimic API calls to configure FusionAuth for use. It will perform all the necessary setup to make this demo work correctly, but if you are curious as to what the setup would look like by hand, the "FusionAuth configuration (by hand)" section of this README describes it in detail.

For now, get FusionAuth in Docker up and running (via docker-compose up) if it is not already running; to see, click here to verify it is up and running.

NOTE: If you ever want to reset the FusionAuth system, delete the volumes created by docker-compose by executing docker-compose down -v. FusionAuth will only apply the Kickstart settings when it is first run (e.g., it has no data configured for it yet).

Running / Development

You can also register a new user for this application and will be automatically logged in after.

Log into the FusionAuth admin screen with a different browser or incognito window using the admin user credentials ("[email protected]"/"password") to explore the admin user experience.

Contributors

fusionauth-example-python-flask's People

Contributors

amans330 avatar andrewpai avatar elliottcarlson avatar fusionandy avatar mooreds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fusionauth-example-python-flask's Issues

example does not demonstrate refresh

It is not clear from this example how one would build a workflow which refreshes without requiring the user to re-authenticate. The example as-is seems to limit the authorization to the time specified for access tokens, not refresh tokens.

According to the documentation, an application that is configured to generate refresh tokens should do so. It seems, however, that a refresh token is only provided if the offline_access scope is specified. The exchange_o_auth_code_for_access_token_using_pkce client method however does not provide a mechanism for specifying the scope, thus the token returned is just an access token with no refresh token, and for the given workflow there is no clear path to refreshing the user's authorization in the event of access token timeout.

This is more of a question than an issue. Is there a standard approach that should be taken for a refresh enabled workflow? It is not clear from this flask example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.