Climate FieldView Authentication with Leaf

How to connect with Climate FieldView via Leaf


In this post, we are going to show you how to easily go through Climate FieldView authorization flow with Leaf, that is, get authorized to access your users’ Climate FieldView data with Leaf. Let’s get to it!


  • Step 0: Create a developer account with Climate FieldView and get your application credentials.
  • Step 1: Get your users’ Climate FieldView tokens with Leaf.
  • Step 2: Add Climate FieldView credentials to Leaf.

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

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

(if you already have a developer account with Climate FieldView, you can skip this step)

Creating a Climate FieldView developer account is a very simple and automatic process, just register with this link.


After being approved by Climate FieldView, they will provide you a clientId, a clientSecret, and an API Key. You will use these three later.

After that, you will have created your developer account and can go to the next step of this tutorial.

Step 1: Get your users’ Climate FieldView tokens with Leaf.

To get your users’ tokens to access their Climate FieldView data, your application must go through Climate FieldView OAuth flow. First, you need to redirect the user to a custom URL that is the Climate FieldView page that will present the user the choice of authorizing your app to access their data.

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


with the following JSON:

Leaf will create an URL containing the minimum scopes (permissions) necessary to fetch Fields, Farms and Operations. Leaf also supports the upload of Fields, Soil and GeoTiff data. If you want to be able to access those extra features, add "scope" to the request body including the base scopes and the scopes for writing fields, soil and imagery. The request body to fetch an URL with the extra scopes should be:

Note that the scopes for the extra features (fields:write, soil:write and imagery:write) may also require additional permissions from Climate FieldView. Ensure that you are allowed to ask for those scopes before generating a URL with them, and contact Climate FieldView to request permission in case you are not.

Leaf will return a URL that you can send your user to, so they can authorize access to their data and be redirected to your app. Note that Climate FieldView will redirect your user to the "redirect_uri" and also send a code that you will need to make a request to get your users' tokens.

Get the user’s tokens

Now we need to get the user’s tokens. Once users log in to Climate FieldView's website link you created, they will authorize your application to access their data and they will be redirected back to the "redirect_uri" you set, linked with a code (like this "https://withleaf.io/?code=AKgMaOmHa1zHxAoOoH"). Then, your application will use this code present in the response URL to get the user’s tokens.

Just send a POST to


with the following header:

This requires you to encode “clientId:clientSecret” (your cliendId and clientSecret from the first step, separated by “:”) to base64. Most programming languages will have a way to encode text to base64, but if you want to do it manually you can use this website:


Also, include the following body (x-www-form-urlencoded):


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

Note: Leaf will manage each and every token, making sure they are always refreshed and valid.

Step 2: Add your Climate FieldView credentials to Leaf

Leaf’s API uses an abstraction called Leaf User to store credentials and organize data for each individual data owner. In most cases, the Leaf User will be the farmer or consultant that has access to the source data inside the machinery company’s FMIS (e.g. John Deere Operations Center or Climate FieldView platform).

Leaf’s API must then be initiated with Climate FieldView credentials in order to access and standardize Climate FieldView data. To send your credentials to Leaf, you will need your access token from Leaf, and have already created a Leaf User. If you don’t know how to do that, here is how you get your access token, and here is how you create a Leaf User.

Now, attach your credentials to the Leaf User you created.

Send a POST to


with the following header: 

and with the following JSON body:


Now Leaf will start fetching your farm data from Climate FieldView. You can now query Leaf for your standardized data.

Get API Keys and Start Building Today!

Software developers use Leaf’s API to build and scale a wide range of products including farm optimization tools, lending products, outcome-based financing, land and input marketplaces, agronomic recommendations, traceability applications, equipment maintenance forecasting, and more.

Here is a link to Leaf’s website and docs to learn more.


Similar posts

Stay in the loop with all of Leaf's future insights, technical updates and latest case studies.

Subscribe to receive our monthly newsletter and newest blog posts with industry leading insights, company updates and more.