Skip to content

Commit

Permalink
Determine the correct version to use after authorizing a farm. #104
Browse files Browse the repository at this point in the history
  • Loading branch information
paul121 committed Mar 4, 2021
1 parent 372dfc7 commit 01960b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/app/app/routers/api_v2/endpoints/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ def authorize_farm(

# Reconnect to the farmOS server and update farm info.
try:
farm_client = get_farm_client(db=db, farm=farm)
version = (2 if len(new_token.access_token) > 60 else 1)
farm_client = get_farm_client(db=db, farm=farm, version=version)

response = farm_client.info()
# Set the info depending on v1 or v2.
Expand Down

0 comments on commit 01960b8

Please sign in to comment.