Skip to content
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

Did Login Method 1 Recently Stop Working? #409

Open
AlanTkachuk opened this issue Jun 25, 2023 · 24 comments
Open

Did Login Method 1 Recently Stop Working? #409

AlanTkachuk opened this issue Jun 25, 2023 · 24 comments
Labels
auth issues Issues authenticating with Webull (creds, MFA, etc)

Comments

@AlanTkachuk
Copy link

I'm referring to the login method here: https://github.com/tedchou12/webull/wiki/Workaround-for-Login-Method-1

Before, I would go to the Webull site, login, go to the trade tab, refresh page, and then find my credentials in one of the responses on the Network tab (I believe the title was "v2"). After that, I used the refresh login method to keep refreshing my credentials before expiration. Last week it was working fine, but today the refresh login response returned a 403 Forbidden error during authentication. I tried to go to the Webull site and can no longer find my credentials in the Network tab.

I did try skipping the refresh login step and use my credentials that had not yet expired, and the API seems to be fetching data just fine. Is anyone else having this issue?

@zhengqinggan
Copy link

I have the same issue. seems webull added image verification, so can't get the credential by the wb.login function or refresh_login function anymore. hope there is a workaround, waiting update of the api. Thank you very much!

@Jakezheng
Copy link

same issue this morning.

@M1NL1TE
Copy link

M1NL1TE commented Jun 26, 2023

Can't login either

@BobLiu20
Copy link

same issue... refresh is not working

@albertcheng
Copy link

same problem, is there still any way to get token programmatically?

@qnguye
Copy link

qnguye commented Jun 27, 2023

I'm not good at Python but this is what I see and someone can update/fix the api would be great :)

They blocked old URL and switching to new ones
New Login URL: https://u1suser.webullfintech.com/api/user/v1/login/account/v2
same post data

Trade Token URL: https://u1suser.webullfintech.com/api/user/v1/security/login
Post data {"pwd":"your_6_digits_pin_hashes"}

@alexh0101
Copy link

alexh0101 commented Jun 27, 2023

@qnguye Thanks for that.

Does anyone know which variable needs to be replaced with the new URL?

Also, what is the URL for refresh_login()?

@qnguye
Copy link

qnguye commented Jun 27, 2023

@alexh0101 what refresh_login do? Is it same as login???

@alexh0101
Copy link

@qnguye
It downloads the new login token for next time you login.

@qnguye
Copy link

qnguye commented Jun 27, 2023

@alexh0101 I'm not sure if we need refresh token anymore. When you login, I see refresh token but it doesn't expire for 60 days. It's long enough to just re-login again, no? You do need to get update trade token, maybe once a day

@Jakezheng
Copy link

can you provide the code you have login

@qnguye
Copy link

qnguye commented Jun 27, 2023

I'm not good at Python but try this (never test myself)
Find:
response = requests.post(self._urls.login(), json=data, headers=headers, timeout=self.timeout)
Replace with:
response = requests.post(f'{self.base_userfintech_url}/user/v1/login/account/v2', json=data, headers=headers, timeout=self.timeout)

Find:
response = requests.post(self._urls.trade_token(), json=data, headers=headers, timeout=self.timeout)
Replace with:
response = requests.post(f'{self.base_userfintech_url}/user/v1/security/login', json=data, headers=headers, timeout=self.timeout)

@qnguye
Copy link

qnguye commented Jun 28, 2023

if you guys trade options, they also changed that too :( Lot of things broke

@Jakezheng
Copy link

someone please update @tedchou12

@rakesh433jntu
Copy link

@albertcheng @BobLiu20 @Jakezheng @zhengqinggan @alexh0101 I believe webull is gonna stop entertaining un official APIs.
I am moving to new broker, I am tired of doing patches.
Thanks Every one

@huaxiawang
Copy link

Webull apparently has its own API, but looks like it's still in Beta. And they only provide to you if you request.
This is what I got from support:

Thanks for reaching out to us. I am happy to assist.

We will add your account to the API whitelist, you may check it after one business day. Please refer to the below instruction:

Step 1: Apply for API. Please click this link: https://www.webull.com/open-api
Step 2: After passing the API review, Register an API Application and set up App Key and Secret following the guidance here: https://developer.webull.com/api-doc/prepare/api_apply
Step 3. Start to use OpenAPI for trading: https://developer.webull.com/api-doc/prepare/start

Note:
1. Webull OpenAPI only supports market orders and limit orders.
2. Trading via API only supports stocks and ETFs.
3. Short trading is not supported.
4. The market data request is not supported via Webull OpenAPI at the moment.

Hope it helps and feel free to reach out if you need further assistance and I'd be happy to help.

@AlanTkachuk
Copy link
Author

@huaxiawang Interesting, thanks for sharing this info. I wonder if there's still some way to access their unofficial api endpoints (I'd be willing to manually refresh credentials every week if needed...). Also, it seems like their api has more limited functionality than the unofficial api. If I remember correctly, you could make short, trailing stop, and otoco orders, as well as buy crypto and trade options, but I suppose that could be because it's in beta and they'll add this functionality later? Anyway, still better than nothing assuming this is the only way forward.

@LukeWang01
Copy link

Hi guys, I just logged in, it works.

Please see below:
#411 (comment)

@rakesh433jntu
Copy link

@LukeWang01 is it working in united states. ?? we bull API version is not in united states. if i ma not wrong its only avaible in south korea

@LukeWang01
Copy link

@LukeWang01 is it working in united states. ?? we bull API version is not in united states. if i ma not wrong its only avaible in south korea

Yes, this API working in U.S.

But the offical API is is currently under Beta testing.

image

@alexh0101
Copy link

alexh0101 commented Jul 12, 2023

Login fails again.
Did they change something again with the endpoints for login in the past 2-3 days?

@rakesh433jntu
Copy link

@alexh0101 did you tried @LukeWang01 #411 able to help login issue.
For me its worked on July 11 2023

@alexh0101
Copy link

alexh0101 commented Jul 15, 2023

When I log in, wb.is_logged_in() gives me "True".

But my wb.get_account() gives me this:
{'msg': 'secAccountId=213*****', 'code': '400', 'success': False}

I'm using this endpoint:
self.base_user_url = 'https://u1suser.webullfintech.com/api'

And this code:

wb = webull()
wb._access_token = 'dc_us_tech1.18********-*************************'
wb.login(username=wb_username,password=wb_password,save_token=True)

Also, I used to use webull_paper() instead of webull(), but webull_paper() doesn't seem to work anymore.

Is there anything I'm missing?

@jasonrush jasonrush added the auth issues Issues authenticating with Webull (creds, MFA, etc) label Nov 17, 2023
@ICANTFINDAUSERNAMEATALL
Copy link
Collaborator

https://github.com/tedchou12/webull/wiki/Workaround-for-Login-%E2%80%90-Method-2

You just need to verify it on your own browser, inspect and get the did(device id) of your browser, and then manually set that as the did in the webull object before you use the login. This way, webull will think that you are logging in from the verified browser. Look around in Method 1/2 if you need help getting the did. You can ignore everything else(I think).

Update the did, not the access token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth issues Issues authenticating with Webull (creds, MFA, etc)
Projects
None yet
Development

No branches or pull requests