Skip to content

Commit

Permalink
Fix requesting app key on instance without auth_dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
fieldOfView committed Apr 23, 2022
1 parent 5743173 commit 46f33b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion DiscoverOctoPrintAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,12 @@ def _onRequestFinished(self, reply: QNetworkReply) -> None:
"w", "Received invalid JSON from octoprint instance."
)

base_url = reply.url().toString()
base_url = base_url[:base_url.find("/plugin/appkeys/request")]

if json_data:
app_token = json_data["app_token"] # unused; app_token is included in location header
auth_dialog_url = json_data["auth_dialog"]
auth_dialog_url = json_data["auth_dialog"] if "auth_dialog" in json_data else base_url
else:
(
instance,
Expand Down

0 comments on commit 46f33b4

Please sign in to comment.