Documentation

Authentication Overview

Pick the token your integration needs: a user's, an organization's, or your app's own.

Every API request carries an OAuth 2.0 bearer token:

Authorization: Bearer <access_token>

Which token depends on who the request acts for. Find your integration below, then follow its page.

Your integrationTokenPage
Signs a person in, or shows them their own Davi dataA user tokenSign In a User
Manages an organization's activities, memberships or rewards while a staff member uses itAn org-scoped token, exchanged from the user'sAct as an Organization
Acts for an organization with nobody signed in: a form handler, a nightly jobAn org-scoped token, from a stored refresh tokenAutomate for Your Organization
Checks a member's entitlements from the organization's own backendA client credentials tokenBelow

Every one of these starts from an app registered to your organization in the dashboard, under Developer → Apps.

Client types

You choose the client type when you register the app:

TypeForAuthenticates to the token endpoint with
Confidential (server-side application)A server that can keep a secretIts client secret, as HTTP Basic or form fields
Public (client-side application)An SPA, mobile or desktop appPKCE alone

What decides the type is whether the secret can be kept from the user, not whether the app has a backend. A single-page app with an API behind it is public if the secret would be shipped to the browser.

A new app can use the authorization code and refresh grants. Token exchange and client credentials are enabled separately on the app's page, after it is created.

Machine-to-machine (client credentials)

A confidential app with the client_credentials grant enabled can get a token for itself, with no user:

curl -X POST "https://api.davi.social/oauth2/token" \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "scope=membership:entitlements:read"

The token carries the scopes you request, limited to those the app was registered with. It has no user and no refresh token.

It also carries no organization, so endpoints that act for an organization refuse it with a 403. The exception is reading membership entitlements, which takes the organization from the app's registration. For anything else an organization does without a person present, see Automate for Your Organization.

Next