Lindsay Authentication with Leaf

22 Apr, 2024

Lindsay Authentication with Leaf

Lindsay Authentication with Leaf

In this post, we will show you how to go through Lindsay's authorization flow with Leaf and get authorized to access your users’ Lindsay data. Let’s get to it!

Summary

Step 0: Create a developer account with Lindsay and get your application credentials.
Step 1: Get your users’ Lindsay tokens with Leaf.
Step 2: Add Lindsay's credentials to Leaf.

Keep in mind that this tutorial is a full walkthrough. Most of the steps presented will be done only once, meaning subsequent calls will be easier and faster.

Step 0: Create a developer account with Lindsay and get your application credentials.

(If you already have a developer account with Lindsay, you can skip this step)

You must obtain Lindsay FieldNET API access credentials directly from Lindsay.

Step 1: Get your users’ Lindsay tokens with Leaf.

To get your users’ tokens to access their Lindsay data, your application must go through the Lindsay OAuth flow. You'll need to redirect the user to a custom URL that will present the user the choice of authorizing your app to access their data.

To get the URL for this authentication step, send a POST to:

With the following JSON:

Leaf will return a URL (signInUrl) that you can send your user, so they can authorize access to their data and be redirected to your app. It will return a codeVerifier that will be used in the next steps.

After authentication, the user must allow access to their data:

Leaf, data infrastructure for agriculture

Get the user’s tokens

Now we need to get the user’s tokens. Once users log in to the Lindsay's website link you created, they will authorize your application to access their data and they will be redirected back to the "redirectUri" you set, linked with a code, like this:

Then use the entire URL redirected from the response to get the user’s tokens, adding it to the responseUrl property.

Send a POST to:

With the following JSON:

A JSON containing the tokens will be returned, and you can add them to Leaf as Lindsay credentials.

Step 2: Add Lindsay's credentials to Leaf.

When you integrate with a provider via Leaf, you'll need to create a 'Leaf User.’ Leaf Users are used to manage provider authentication and to organize data for your end users. In most cases, the Leaf User will be the farmer or consultant that has access to the source data via the provider’s system.

To send your credentials to Leaf, you will need your access token from Leaf and to have already created a Leaf User.

Here is how you get your access token.
Here is how you create a Leaf User.

note: Multiple providers can be attached to the same Leaf User so you can query data for all providers at one time.

Now, attach your credentials to the Leaf User. Send a POST to

with the following Header:

and with the following JSON

 Leaf | Data infrastructure for agriculture

Lacey Baker

Product Support Manager

Lacey Baker, Iowa native, is the Product Support Manager 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, which makes her a fantastic conduit between our customers' success and product development.

Connect with me

Ready to begin?

Get API Keys and Start Building Today!

Sign up for free account

Questions? Get in touch