This app shows how to implement the OAuth2.0 flow and call the Miro REST API's Create Board endpoint, using Flask / Python.
flask_python_starter_with_oauth_demo.mov
- Included Features
- Tools and Technologies
- Prerequisites
- Run the app locally
- Folder Structure
- Contributing
- License
- You have a Miro account.
- You're signed in to Miro.
- Your Miro account has a Developer team.
- Your development environment includes Node.js 14.13 or a later version.
- You have the latest versions of Flask and Python installed.
-
Create a new Miro App and make sure to check the box for
Expire user authorization token
as shown in the screenshot below.β οΈ If you don't check this box, the app will not work!β οΈ
-
Install the project dependenciesAwes by running
pip3 install -r requirements.txt
-
Create your
.env
file by copying the template, and use it to store your credentials:cp sample.env .env
-
In your account profile, go to Your apps, and then select the app you just created to access its settings page.
On the app settings page:- Go to App Credentials, and copy the app Client ID and Client secret values.
- Paste these details to your
.env
file'sclientID
andclientSecret
variables.
-
From your App Settings page, open the app manifest editor by clicking Edit in Manifest. \
In the app manifest editor, configure the app as follows and then click save:
# See https://developers.miro.com/docs/app-manifest on how to use this
appName: Python Flask Starter with OAuth
sdkVersion: SDK_V2
sdkUri: http://127.0.0.1:5000
redirectUris: http://127.0.0.1:5000/callback
scopes:
- boards:read
- boards:write
- Run the app with
python3 app.py
- Open the page at
http://127.0.0.1:5000
.
βββ templates
β βββ index.html <-- The html view for users who have not yet authorized Miro
β βββ loggedin.html <-- The html view for users who have authorized Miro
β
βββ app.py <-- The python script. This script runs Miro's OAuth flow and calls the Miro REST API.
βββ sample.env <-- Sample .env file to show format of environment variables
βββ requirements.txt <-- The python requirements file
If you want to contribute to this example, or any other Miro Open Source project, please review Miro's contributing guide.