Fix Zerodha callback state propagation

This commit is contained in:
Thigazhezhilan J 2026-04-12 20:17:48 +05:30
parent 988443f40f
commit b5b759c5ed

View File

@ -33,7 +33,9 @@ def build_login_url(api_key: str, redirect_url: str | None = None, state: str |
if redirect_url:
params["redirect_url"] = redirect_url
if state:
params["state"] = state
# Kite Connect echoes redirect_params back to the redirect URL.
# Using a raw "state" query parameter here is not reliable.
params["redirect_params"] = urllib.parse.urlencode({"state": state})
query = urllib.parse.urlencode(params)
return f"{KITE_LOGIN_URL}?{query}"