title: How to use existing login token for telegram web using selenium webdriver
body: <p>I'm trying to read telegram messages from <a href="https://web.telegram.org" rel="nofollow noreferrer">https://web.telegram.org</a> with selenium.</p>
  
  <p>When i open <a href="https://web.telegram.org" rel="nofollow noreferrer">https://web.telegram.org</a> in firefox i'm already logged in, but when opening the same page from selenium webdriver(firefox) i get the login page. </p>
  
  <p>I saw that telegram web is not using cookies for the auth but rather saves values in local storage. I can access the local storage with selenium and have keys there such as: "dc2_auth_key", "dc2_server_salt", "dc4_auth_key", ... but I'm not sure what to do with them in order to login(and if i do need to do something with them then why? its the same browser why wont it work the same when opening without selenium?)</p>
  
  <p>To reproduce:</p>
  
  <p>open firefox and login to <a href="https://web.telegram.org" rel="nofollow noreferrer">https://web.telegram.org</a> then run this code:</p>
  
  <pre><code>from selenium import webdriver
  
  driver = webdriver.Firefox()
  driver.get("https://web.telegram.org")
  # my code is here but is irrelevant since im at the login page.
  driver.close()
  </code></pre>