AgLeader Authentication with Leaf

09 Oct, 2021

AgLeader Authentication with Leaf

AgLeader Authentication with Leaf

In this article we will walk you through the authorization process of AgFiniti, the AgLeader platform software. We will also go through how to link AgFiniti to your Leaf users and start retrieving data.

(Clique aqui para a tradução em português)

Summary

  • Step 0: Create your AgFiniti account
  • Step 1: Get your AgLeader developer credentials
  • Step 2: Get your AgLeader tokens
  • Step 3: Create a Leaf User with AgLeader credentials on Leaf

The following steps are a full walkthrough. Once you follow the necessary steps you will not need to repeat them for subsequent calls.

Step 0: Create a developer account with AgLeader

This step can be skipped if you already have an account in AgLeader.

Please complete this form to create your account.

Step 1: Get your AgLeader developer credentials

Log in to your AgLeader account with the following URL https://www.agfiniti.com/Home/Welcome

Leaf, data infrastructure for agriculture

Next, navigate to the “Consumer Keys” tab and save the Public and Private Key for later use.

NOTE: Even though you're integrating with Leaf, AgLeader will require your proof of liability insurance and a one time fee before providing developer credentials.

Step 2: Get your AgLeader tokens

In this next step, we are going to use the /authorize URL to retrieve your Bearer Token (Access Token) and Refresh Token. You need to set parameters that will allow you to configure permissions on your account.

Here is an example:

https://www.agfiniti.com/api/oauth2/authorize?response_type=code&client_id= _your_Public_ Key_ &scope=openid%20profile%20email%20filedownload

Once you add your Public Key to the URL, you will be redirected to the page that contains your Access Token and Refresh Token.

Step 3: Create a Leaf User with AgLeader credentials on Leaf

Your AgFiniti credentials must be linked to a Leaf User in order to access the data from your user’s AgFiniti account. After creating a Leaf User and adding these credentials to the Leaf User, the files will be retrieved and then standardized, and available within a few minutes. Operation files will take several hours to complete processing.

TO CREATE A LEAF USER

POST to

https://api.withleaf.io/services/usermanagement/api/users/

with the following Header: Authorization: Bearer

note: https://docs.withleaf.io/docs/quickstart#authentication

ADD AGLEADER CREDENTIALS TO YOUR LEAF USER

POST to

https://api.withleaf.io/services/usermanagement/api/users//ag-leader-credentials

with the following Header: Authorization: Bearer

and with the following JSON as the request payload:

{

"refreshToken" : "{ { your refresh token } }",

"publicKey": "{ { your public key } }",

"privateKey": "{ { your private key } }"

}

GET ALL FILES FROM THAT LEAF USER

GET to

https://api.withleaf.io/services/operations/api/files?leafUserId=&provider=AgLeader

With the following Header: Authorization: Bearer

 Leaf | Data infrastructure for agriculture

Lacey Baker

Customer Support Lead

Lacey Baker, originally from Iowa, is the Customer Support Lead with Leaf Agriculture. She started her career in the health industry serving as a certified medical assistant but her love for agriculture drew her over to the agriculture industry. She has worked in IT and digital customer support with DuPont Pioneer, MapShots, Inc., and Granular where she managed support teams and implemented ticket resolution processes. Lacey is passionate about building relationships, and is driven for excellence.

Connect with me

Ready to begin?

Get API Keys and Start Building Today!

Sign up for free account

Questions? Get in touch