How to Create a Cloverleaf Integration as a Developer
Contact the Cloverleaf engineer team at support@cloverleaf.me and tell us you’re creating a Cloverleaf Integration.
Provide us the following information:
integration name
description
square logo image (ideally 80x80 px or larger)
integration documentation URL OR company URL
support URL OR email address
best point of contact’s email address for this integration, which might be yours
your integration's callback URL / redirect URI (which you see referenced in below instructions)
In return, we will issue you a client ID and secret. We use the OpenID Connect (OIDC) protocol for authentication and these pertain to it.
Now that you have the client ID and secret, you can integrate using OIDC. The flow is:
GET https://app.cloverleaf.me/api/oidc/auth with parameters:
response_type=code
scope=openid
client_id=<your client ID>
redirect_uri=<integration's callback URL>
state=<unique, ideally random state value>Note the
redirect_uri
above. This is your integration’s callback URL for receiving, via URL parameters, the authorization code.A
303 Redirect
response will come back, sending the user to:sign into Cloverleaf if not already
then the SSO Consent page, where they click Authorize to allow the integration access to Cloverleaf
Once Authorized, your
redirect_uri
will be hit with aGET
request, with the following URL params:code
the authorization code your integration will use to exchange for an access tokeniss
the auth code issuer, which is Cloverleafstate
the unique state value your integration initially provided, for verification
Once the auth code is obtained, it’s time to exchange it for the access token that lets the integration use Cloverleaf
Your integration will make a POST request:
POST https://app.cloverleaf.me/api/oidc/token
with x-www-form-urlencoded parameters:
client_id: <your client ID>
client_secret: <your client secret>
grant_type: authorization_code
code: <auth code given in Step 7>
redirect_uri: <integration's callback URL>An
access_token
will be returned, allowing the integration access to Cloverleaf on behalf of the user.Provide this
access_token
in theauthorization
header as a bearer token when calling the Cloverleaf Public API endpoint:
GET https://app.cloverleaf.me/public-api/v1/self/daily-coaching