robin_stocks icon indicating copy to clipboard operation
robin_stocks copied to clipboard

Need help!! Can't get login working. Struggling for 2 days :(

Open chulbulpande opened this issue 1 year ago • 6 comments

Hi friends, I had this working a few months back and not its all broken.. can someone pleaaaaaaaaaaaaaase help me just to get past the login trouble?

chulbulpande avatar Feb 06 '25 22:02 chulbulpande

even I am facing similar issue after the token is expired since today. ERROR: There was an issue loading pickle file. Authentication may be expired - logging in normally. Traceback (most recent call last):

raise Exception(data['detail'])

KeyError: 'detail'

Mohasin1 avatar Feb 06 '25 23:02 Mohasin1

I really hope someone jumps in and shows how to fix.

chulbulpande avatar Feb 06 '25 23:02 chulbulpande

#537 could help

alex-l-zhou avatar Feb 07 '25 06:02 alex-l-zhou

I am working on this

ojedaJD avatar Feb 09 '25 01:02 ojedaJD

I was working on rewriting the library in go, there is a different authentication verification workflow I did this and then changed the _validate_sherrif to _validate_sherrif_id1 and device authentication now works for me.

 def _validate_sherrif_id1(device_token: str, workflow_id: str):
   url = "https://api.robinhood.com/pathfinder/user_machine/"
   payload = {
        "device_id": device_token,
        "flow": "suv",
        "input": {"workflow_id": workflow_id}
    }
  
  data = request_post(url, payload, json=True)
  
  if "id" not in data:
      raise Exception("ID not returned in verification workflow")
  
  inquiries_url = f"https://api.robinhood.com/pathfinder/inquiries/{data['id']}/user_view/"
  res = request_get(inquiries_url)
  
  challenge_id = res["type_context"]["context"]["sheriff_challenge"]["id"]
  status_url = f"https://api.robinhood.com/push/{challenge_id}/get_prompts_status/"
  
  count = 0
  while count < 3:
      print(f"Checking challenge status, attempt {count+1}...")
      status_data = request_get(status_url)
      
      challenge_status = status_data.get("challenge_status", "unknown")
      print(f"Current Challenge Status: {challenge_status}")
      
      if challenge_status == "validated":
          print("Sheriff ID validation successful.")
          inquiries_payload = {"sequence": 0, "user_input": {"status": "continue"}}
          final_data = request_post(inquiries_url, inquiries_payload, json=True)
          
          if final_data.get("type_context", {}).get("result") == "workflow_status_approved":
              print("Final workflow approval successful.")
              return
          else:
              raise Exception("Workflow approval failed.")
      
      if challenge_status == "issued":
          print("Challenge is still pending, retrying in 15 seconds...")
          time.sleep(15)
          count += 1
      else:
          break
  
  raise Exception("Sheriff challenge failed after maximum retries.")

ojedaJD avatar Feb 09 '25 01:02 ojedaJD

does anyone know which version is stable from login perspective? this was working before i am not sure what has changed

arezazadeh avatar Feb 25 '25 03:02 arezazadeh