Authenticating
TL;DR
Add a default authentication profile to automatically create .motaword/credentials.json
:
motaword auth add-profile client-credentials default MY-CLIENT-ID MY-CLIENT-SECRET
Authentication details
motaword
CLI requires a MotaWord developer account and an API client ("app" as we call them). You can create one here: https://www.motaword.com/developer
Once you have a developer account, create a new app on your Developer Portal. Now you can access your API client ID and secret for this app.
You need to use these keys with your motaword
CLI by putting them in .motaword/credentials.json
file. This is what credentials.json
looks like:
{
"profiles": {
"default": {
"client_id": "my-client-id",
"client_secret": "my-client-secret",
"type": "client-credentials"
}
}
}
motaword
CLI lets you have multiple profiles for authentication. default
profile is sufficient in most use cases, but you can have multiple profiles with arbitrary names (e.g secondary-profile
in place of default
in the example above).
We provide a way to automatically manage your authentication profiles:
> motaword auth
Authentication settings
Usage:
motaword auth [command]
Available Commands:
add-profile Add user profile for authentication
list-profiles List available configured authentication profiles
Flags:
-h, --help help for auth
You can add a profile with this command:
> motaword auth add-profile client-credentials <name> <client-id> <client-secret>
Let's add a default profile:
motaword auth add-profile client-credentials default my-client-id my-client-secret
That's it! motaword
CLI will manage the authentication for you including reusing and refreshing your API access tokens.
Updated about 2 years ago