Skip to content

docs: Flask integration tutorial#2126

Merged
mooreds merged 32 commits intoFusionAuth:masterfrom
ritza-co:flask-integration
May 10, 2023
Merged

docs: Flask integration tutorial#2126
mooreds merged 32 commits intoFusionAuth:masterfrom
ritza-co:flask-integration

Conversation

@sixhobbits
Copy link
Collaborator

No description provided.

@sixhobbits sixhobbits requested a review from mooreds April 28, 2023 11:56
@mooreds mooreds added the content Alert marketing to this change label Apr 28, 2023
Copy link
Contributor

@mooreds mooreds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really close.

  • need to add a flask row to docs/quickstarts/index.html (webapps section). I can take care of the logo, but please add the row.
  • update example app to point to the new repo.

Now, cut and paste the following requirements into `requirements.txt`:

```text
{% remote_include https://raw.githubusercontent.com/ritza-co/fusionauth-flask-integration/main/requirements.txt %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the latest version of fusionauth_client here, please?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mooreds I have opened a PR here to update the example to use the latest version of fusionauth_client. So the change will reflect once that is merged. The includes are now pointing to that repo.

Then, copy and paste the following code into the `setup.py` file.

```python
{% remote_include https://raw.githubusercontent.com/ritza-co/fusionauth-flask-integration/main/setup.py %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I've been collecting these here: https://github.com/FusionAuth/fusionauth-example-client-libraries and you should be able to reuse setup.py from that directory.

{% remote_include https://raw.githubusercontent.com/ritza-co/fusionauth-flask-integration/main/setup.py %}
```

Then, you can run the setup script. Please note that this setup script is designed to run on a newly installed FusionAuth instance with only one user and no tenants other than "Default". To follow this guide on a FusionAuth instance that does not meet these criteria, you may need to modify the above script. Refer to the [Python client library](/docs/v1/tech/client-libraries/python) documentation for more information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good caveat, but maybe should be called out as a note. Since we are having folks install FusionAuth using docker, they won't be doing this on an existing system.

If you write it as a note, let's make it abstract enough we can push it through to the other tutorials.

fusionauth_api_key=<your API key> python setup.py
```

If you are using PowerShell, you will need to set the environment variable in a separate command before executing the script.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. We should push this across the other tutorials. You can leave that as a task for me.


Now, create a new `requirements.txt` file to include {{page.technology}}. Add the `flask`, `python-dotenv`, and `authlib` plugins so that your requirements file looks like this:

```text
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can now start writing the code for your Flask application. Create a new file called `server.py` and add the following import statements into it:

```python
import json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these, we tend to put the whole file in at once, not breaking it down addition by addition.

This means you can use remote_include to pull in the entire file and you don't need to breakdown what is happening.

rideam and others added 3 commits May 9, 2023 14:33
Co-authored-by: Dan Moore <github@mooreds.com>
# Conflicts:
#	site/_layouts/doc.liquid
#	site/docs/v1/tech/tutorials/index.adoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content Alert marketing to this change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants