This sample app will show you how to implement Adobe OAuth 2.0 in Python using the Flask framework.
After setting up the sample, you will have a Python app that:
- Serves
templates/index.htmlonhttps://localhost:8000 - Lets a user log in with their Adobe ID
- Prompts the user to authorize the app with requested scopes
- Lets the user view their Adobe ID profile information
- Lets the user log out
You can find a companion repo for this developer guide on GitHub.
Be sure to follow all instructions in the readme.
- Python 2.6 or greater and the
pippackage manager - OpenSSL CLI
This guide will assume that you have read the Adobe OAuth 2.0 Guide for Web.
You must also have a registered app on the Adobe Developer Console with the following settings:
Platform: webDefault redirect URI:https://localhost:8000Redirect URI Pattern:https://localhost:8000
The following steps will help you get this sample up and running.
Adobe OAuth 2.0 requires SSL, so you will need to create a self-signed cert using the OpenSSL CLI:
$ openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
Make sure that after running this command you have the cert.pem and key.pem files at the top level of the sample app.
This sample app uses the Flask, Requests, and Six libraries. You can install them using the pip package manager:
$ pip install flask
$ pip install requests
$ pip install six
Enter the required credentials in config.py:
class Config(object):
FLASK_SECRET = 'PLACEHOLDER_SECRET_KEY'
ADOBE_API_KEY = 'YOUR_ADOBE_KEY'
ADOBE_API_SECRET = 'YOUR_ADOBE_SECRET'
You can get your Adobe API Key and Secret from your registered app page on the Adobe Developer Console.
After completing the configuration steps, run adobe-oauth2.0.py:
$ python adobe-oauth2.0.py
To access the app, go to https://localhost:8000. Click through any cert warnings in the browser.