Authentication

There are two ways of authenticating yourself with the moco api. Via api key and via your own user email and password.

Via api key

You can find your own api key under your user profile when you log into your account.

from moco_wrapper import Moco

wrapper = Moco(
    auth={
        "api_key": "[YOUR API KEY]"
        "domain": "testabcd" #your full domain would be testabcd.mocoapp.com
    }
)

Note

The api key is always associated with the user it belongs to. Things like activities and presences always work in context of the current user. If you want to be someone else see Impersonation.

Note

This method is faster than authenticating via username and password because it skips the authentication requests (with an api key, you already are authenticated).

Via username and password

The second way you can authencate is via your own user information (username and password).

from moco_wrapper import Moco

wrapper = Moco(
    auth={
        "email": "my-account-email@mycomapany.com",
        "password": "my account password",
        "domain": "testabcd" #full domain is testabcd.mocoapp.com
    }
)

Note

If you authenticate in this way an extra request will be sent, before you try to request any actual ressources of the api, for obtaining valid authentication.