Skip to content

workos/python-authkit-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python integration example using AuthKit

An example application demonstrating how to authenticate users with AuthKit, Flask and the WorkOS Python SDK.

Refer to the User Management documentation for reference.

Prerequisites

You will need a WorkOS account.

Requirements

Python 3

Running the example

  1. In the WorkOS dashboard, head to the Redirects tab and create a sign-in callback redirect for http://localhost:3000/callback.

  2. After creating the redirect URI, navigate to the API keys tab and copy the Client ID and the Secret Key. Rename the .env.example file to .env and supply your Client ID and API key as environment variables.

  3. Additionally, create a cookie password as the private key used to encrypt the session cookie. Copy the output into the environment variable WORKOS_COOKIE_PASSWORD.

    It has to be exactly 32 characters long. You can use https://1password.com/password-generator/ to generate strong passwords. Alternatively, use the OpenSSL library to generate a secure password:

    openssl rand -base64 24
  4. Verify your .env file has the following variables filled.

    WORKOS_CLIENT_ID=<YOUR_CLIENT_ID>
    WORKOS_API_KEY=<YOUR_API_SECRET_KEY>
    WORKOS_REDIRECT_URI=http://localhost:3000/callback
    WORKOS_COOKIE_PASSWORD=<YOUR_COOKIE_PASSWORD>
  5. Install the dependencies

    pip install -r requirements.txt
  6. Run the following command and navigate to http://localhost:3000.

    python app.py

About

Example app for AuthKit in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published