Python Auth Library

White Label Data provides anauth library, written in Python, for accessing information about users. To use the auth library from your Python files in the /extensions folder, include the library as follows:

import auth

Get Basic User Info

From within a Django view in apis.py, you can access the user info by passing along the Django request as follows:

auth.getBasicUserInfo(request)

Returns a dictionary of user information about the current user.

{
    "userId" : "auth0_112233",
    "firstname" : "John",
    "lastname" : "Adams"
}

Get Custom Attributes for User

All API calls run in the current user context. You can ask White Label Data for all attributes associated with the user and use them from within your backend API calls.

auth.getCustomAttributesUser(request)

Returns a dictionary of user attributes stored in Auth0 for the user.

Note:: The above functions are useful from within Django views in apis.py. To access user information from within a custom query or transform, you can access the user attributes and user ID from within the filters argument of the custom function call.