tedchou12 / webull

Unofficial APIs for Webull.
MIT License
601 stars 185 forks source link

Did Login Method 1 Recently Stop Working? #409

Open AlanTkachuk opened 1 year ago

AlanTkachuk commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

same issue this morning.

M1NL1TE commented 1 year ago

Can't login either

BobLiu20 commented 1 year ago

same issue... refresh is not working

albertcheng commented 1 year ago

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

qnguye commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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

alexh0101 commented 1 year ago

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

qnguye commented 1 year ago

@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 commented 1 year ago

can you provide the code you have login

qnguye commented 1 year ago

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 commented 1 year ago

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

Jakezheng commented 1 year ago

someone please update @tedchou12

rakesh433jntu commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

Hi guys, I just logged in, it works.

Please see below: https://github.com/tedchou12/webull/issues/411#issuecomment-1622893826

rakesh433jntu commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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

rakesh433jntu commented 1 year ago

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

alexh0101 commented 1 year ago

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?

ICANTFINDAUSERNAMEATALL commented 1 year ago

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.