OAuth (John Deere)
FieldMCP uses OAuth 2.0 to connect farmers to their John Deere accounts. Once authorized, FieldMCP can access the farmer's field data, equipment, and operations through the MCP tools.
How It Works
- Developer initiates connection from Dashboard
- Farmer is redirected to John Deere sign-in
- Farmer authorizes access (scopes:
ag1ag2ag3) - FieldMCP receives and encrypts the OAuth tokens
- Developer can now make MCP calls for that farmer
Connecting a Farmer
From the Dashboard
- Go to Dashboard > Farmers
- Click Connect Farmer
- Share the authorization link with the farmer
- The farmer signs into John Deere and authorizes access
- The farmer appears in your dashboard once authorized
Programmatically
Use the enterprise REST API to initiate the OAuth flow:
# Get the authorization URL
curl -X POST https://gateway.fieldmcp.com/api/v1/oauth/authorize \
-H "Authorization: Bearer field_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"redirect_uri": "https://yourapp.com/callback"}'Token Management
- Access tokens expire after 30 minutes and are refreshed automatically
- Refresh tokens last ~90 days and extend on each use
- Encryption — All tokens are encrypted with ChaCha20-Poly1305 before storage
- Automatic refresh — The gateway refreshes tokens on-demand when they have less than 5 minutes remaining
You don't need to manage token refresh yourself — FieldMCP handles it transparently.
Scopes
FieldMCP requests these John Deere OAuth scopes:
| Scope | Access |
|---|---|
ag1 | Fields, boundaries, farms, clients |
ag2 | Equipment, telemetry, operations |
ag3 | Agronomic data, prescriptions |
offline_access | Refresh token for long-lived access |
Disconnecting a Farmer
To revoke access:
- Go to Dashboard > Farmers
- Click the farmer's row
- Click Disconnect
This revokes the OAuth tokens and removes the farmer's data from the cache. The farmer can also revoke access from their John Deere account settings.
Errors
| Error | Cause | Resolution |
|---|---|---|
TOKEN_EXPIRED | Refresh token expired (~90 days) | Farmer needs to re-authorize |
TOKEN_REVOKED | Farmer revoked access | Farmer needs to re-authorize |
MISSING_SCOPE | Missing required OAuth scope | Re-authorize with correct scopes |
PROVIDER_NOT_CONNECTED | No OAuth tokens for this farmer | Connect the farmer first |