Skip to content

Authenticate Python Client with Portal

Please visit the Access Tokens page for how to obtain access tokens and organization IDs.

Environment Variables

If you use Faceware Portal specific environment variables for authentication, the only code required to start working with Portal is the following code snippet:

from pyportal import PortalClient

client = PortalClient()
client. # press <TAB> for autocompletion
Environment Variable Description
FACEWARE_PORTAL_ACCESS_TOKEN The Faceware Portal Access Token
FACEWARE_PORTAL_ORGANIZATION_ID The Faceware Portal Organization ID for your account.

Native Authentication

You can initialize the Faceware Portal client by setting the access_token and organization_id directly.

from faceware.pyportal import PortalClient

client = PortalClient(
    access_token="{YOUR-ACCESS-TOKEN}",
    organization_id="{YOUR-ORGANIZATION-ID}"
)
client. # press <TAB> for autocompletion

Danger

We do not recommend hard coding access tokens into source code.