Appearance
Client Credentials
The client_credentials grant lets an app act by itself, with no person at the keyboard. Who it acts as follows from who owns the app in the developer portal:
- An app owned by an organization that signed in with Knowify acts as that company's API user, the one Knowify keeps for exactly this. If the company has no API user yet, the API answers
403with API access is not enabled for this Knowify account. Contact Knowify support to enable it. - An app owned by a person who signed in with Knowify acts as that person, with their rights and nothing more.
- Any other app is refused the grant. Register it under your Knowify organization, or sign in with Knowify, and ask for the token again.
Every call made this way is recorded as the API user or the person, with the app named behind them. A server or a scheduled job that should act as a particular person instead connects once and keeps itself connected with its refresh token: see Unattended Access.
Getting a token
Create the app in the developer portal as Server to server. An organization's owners and admins are the ones who can create an app in its name, so an app that acts as a company's API user is always one an administrator of that company set up. It gets a client id and a secret and no redirect URI. Ask the token endpoint with the secret as HTTP basic credentials and the scopes you want; the answer is an access token and nothing else, since nobody is signed in to be refreshed.
bash
curl -X POST https://developer.knowify.com/oauth/token \
-u "$CLIENT_ID:$CLIENT_SECRET" \
-d "grant_type=client_credentials" \
-d "scope=projects:read invoices:read"Scopes bound what the token may ask for; the owner's own rights bound what it gets. The API user's rights are what Knowify support set for the company's integrations, a person's are their own.
The owner is fixed
A server-to-server app acts as its owner, so its owner cannot change: the developer portal offers no move for it, and PUT /admin/clients/:id/owner answers 409 for it, whoever asks. Who it acts as is read from its owner at the token endpoint and again on every call, and that owner is the one it was created under.
To run an integration as a different owner, create a new server-to-server app under that owner, put its secret in place, and retire the old one. Other app types can still be moved between the parties you may act for.