-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Authentication Error #2
Comments
Same here. I am using Mac and the localhost does not seem to recognize that I have authenticated my account although the browser says it is successful. I tried to use system python3 instead of conda python3; different java installations, but the problem persists. |
Alright, I think I fixed the issue. The problem was the logic I wrote for determining whether the session was valid or not. The endpoints can be very inconsistent with responses unless you call them in a very specific order. Try out the modifications and let me know if it works on your guys' end. |
Hey Alex, thanks for the update! While trying to use the new library I encountered two issues:
I'd like to finish by apologizing for bothering you with all these issues. I really appreciate the work you've done so far and I'm very excited to try out this library. If there is any other information you need from me don't hesitate to ask. |
ConfigI modified the readme to include instructions on how to set up the Clientportal BetaRegarding this, I modified the file path so that it references However, I can't always assume that people will be directly in the folder, in fact, when they install the library they definitely won't be. With that in mind, it was a change I was going to have to make so that hopefully will fix your issue. I will also more than likely completely get rid of the Let me know if these fix your issues. |
@Spedius I think this might be the same issue I was having. Assuming you were able to login on localhost:5000, this error results from the base url being: localhost:5000/v1/api instead of: localhost:5000/v1/portal You would have to go in and edit the client file in the repository, it's in the make request function. |
Sorry for the confusion. Change the r'portal/' to r'api/'. If that doesn't fix it, then it's a different error. Also, you can look in the logs folder of the clientportal to see exactly the base url for the authentication is. |
Well, this is very odd, so are you both able to get a working version when you specify the I'm guessing it has something to do with the authentication, but it's so weird that it doesn't take Could you give me a little more background on what is going on when you receive the issue? For example, do you have Trade Workstation open? Are you logged in online or anything like that? |
@areed1192 I quickly pulled up VSC and attempted the standard log in procedure (no TWS, only login from the localhost link provided by the program into the terminal). In the following image you see two attempts to log in: the first with the I am not logged in by any other means nor do I have any other IBKR software open. If you want to see me run the program in real time please feel free to reach out. What an odd authentication process! Thanks (yet again) for your help. EDIT: I switched it back to Suffice to say I am at a loss. |
@areed1192 When I run the server, I see that the version of the API is from April 4th 2020, whereas the one from your videos is from sometime in March. Could that have something to do it? I have to say, I am not experienced at all with HTTP, or REST API's so this is a learning experience for me. When I look at the logs in the clientportal/logs folder they show the endpoint having /api instead of /portal all the time, so that is why I changed it to /api. Update: Another thing I have noticed, not necessarily related to the base url, is that the process id saved in the json file is not the server process id, but the pid for the run.sh command and killing the run.sh command does not kill the server (at least on mac). Killing the server process id does kill the run.sh command though. Not sure if that's how it's supposed to be. |
@human1996 The error your experiencing can be very erratic from what I can tell. The problem is it only seems to appear when you log in to a new session after canceling the old one a while back. For example, I only experience this issue once a day when I log in for the first time. At this point, I'm not entirely sure how to fix it. My solution so far has been to let the error run through once and then do it again. I'm going to keep looking into it but I can't promise a fixed date at this point. |
Hello! Thank very much for you rushly answer, I really apreciate it. |
Alright, so I did more testing on the authentication process and I think I got it in a good spot where it should connect reliably. Here are some things I've noticed through this process.
@human1996 The redirect URL is the one provided by Interactive Brokers, I used to use the old one but that seemed to have issues with it. After reaching out to Interactive Brokers they recommended I use that one. From what I can tell, the authentication error seems to be related to the previous session. If for whatever reason that didn't close out correctly then it conflicts the authentication process. The weird thing is that it'll say you're not authenticated sometimes but you can clearly make requests. The reality is this API seems to have a lot of bugs in it, so it's going to be a "one step at a time" process to identify the error, work on a solution, and then integrate. |
This may not be directly related to this package? But has anyone tried the interactive broker websocket? It worked for me initially but now it failed. Couldn't figure out why. |
yes, having same issue in Mac. @benjaminpolk did you find any solution? Thank you. |
This is how I fixed the issue with Mac, I've placed the script in start_server.sh file content of start_server.sh
in client.py
|
This makes complete sense, but not working for some reason. I'll keep trying. Thanks for this! |
Just wanted to update you all that I rewrote the authentication process for the library. In essence, we can't use the endpoints we want to during all hours. Some endpoints will only behave correctly during normal market hours. What I had to do is not check if you're authenticated but instead if you can actually make requests to different endpoints. A person will show "not authenticated" but still able to make all the requests. Don't ask me why because I have no clue. The API is very inconsistent, it will work "better" during market hours, but not so good on weekends or evenings. Here is the new version PyPI: pip install interactive-broker-python-web-api==0.1.1 |
Did you update the library? I haven't had any issues as of late with the authentication. |
Hi @areed1192 , |
I already mentioned it on your youtube channel, but I thought it might also be prudent to note it here:
In essence, even after authenticating the account at the user's end, the server does not accept the authentication request, so the library can not be used. The image attached shows the VSC terminal, as well as the associated command terminal and website confirmation of authentication.
You mentioned it was due to the order in which endpoints were called, and I'd love to learn more about what in particular is causing that problem.
Thank you!
The text was updated successfully, but these errors were encountered: