grindsa / dkb-robo

library to access the internet banking area of "Deutsche Kreditbank" to get account information and transactions
GNU General Public License v3.0
148 stars 29 forks source link

New|Alternative DKB Frontend starting May 2023 #39

Closed chaoslion closed 1 year ago

chaoslion commented 1 year ago

Hey Guys,

DKB is launching an (alternative) login page: https://bank.dkb.de/dein-neues-banking/?wt_mc=pk.ba_ga.fsm.lang.g.230417.

Schneller ins neue Banking – die Login-Seite ändert sich Ab Anfang Mai gibt es frischen Wind auf deiner Anmeldeseite. Du kannst dich wie gewohnt im bisherigen Banking anmelden oder mit deinen Anmeldedaten das neue Banking ausprobieren.

The transaction list seems to be limited to 1 Year:

Du hast das Ende deiner Umsatzliste erreicht. Wir können Umsätze bis zu 360 Tage anzeigen.

They also seem to change the csv format a bit:

"Konto";"<NAME> <IBAN>"
""
"Kontostand vom <DATE>:";"<AMOUNT> EUR"
""
"Buchungsdatum";"Wertstellung";"Status";"Zahlungspflichtige*r";"Zahlungsempfänger*in";"Verwendungszweck";"Umsatztyp";"Betrag";"Gläubiger-ID";"Mandatsreferenz";"Kundenreferenz"
grindsa commented 1 year ago

I did already saw this yesterday but could not log in as I did not get the 2FA confirmation in my banking app. Based on what you wrote I assume you were able to login. Thus, which dkb-app are you using?

chaoslion commented 1 year ago

i'm using the (new?) one (version 1.29.1): https://play.google.com/store/apps/details?id=com.dkbcodefactory.banking

grindsa commented 1 year ago

I am using the older app as it has more features than the one you are using. Anyway let me upgrade over the weekend and look what I can do.

DominikRoB commented 1 year ago

If you can, please keep the old methods working for a few more versions.. I am actively trying to avoid their new updates until all bugs are fixed.

grindsa commented 1 year ago

Hi, I will do all my changes in a separate branch. The current module should work as long as DKB keeps the old banking portal alive... But lets see. Next week we will know more...

grindsa commented 1 year ago

Had a look this morning. First thoughts: it does not look that bad. Authentication is based on bearer token so different than before. The new UI is limited in functionality and you can switch to the "legacy" webpage without reauthentication. So there is a good chance that the current methods can be kept and adapted over time and its just the login method which needs to be changed.

grindsa commented 1 year ago

Just to keep you guys updated; I extended the library to support logins via the new frontend. After logging a switch to the "old" website will be performed and the data get scraped there. That means that all methods will continue to work for the time being. Support is still experimental, thus please do not use the code in production.

Modifications got pushed to devel and ready for wider testing. Feedback is always welcome. For the moment i have no plans to incorporate to master as there are still api-changes happening from time to time.

You can test the new frontend by using the legacy_login=False option:

with DKBRobo(DKB_USER, DKB_PASSWORD, TAN, legacy_login=False) as dkb:
  ...
chaoslion commented 1 year ago

I can confirm, it works really well

python3 -m pip install git+https://github.com/grindsa/dkb-robo.git@devel Branch 'devel' set up to track remote branch 'devel' from 'origin'. Resolved https://github.com/grindsa/dkb-robo.git to commit 2022269004878a7bd91c948ccf05417ff2d37172

>>> from dkb_robo import DKBRobo >>> dkb = DKBRobo("user", "pass", legacy_login=True) >>> dkb.__enter__() check your banking app and confirm login... >>> dkb.account_dic {0: {'name': 'xzy', ... >>> dkb.get_transactions("https://www.dkb.de/DkbTransactionBanking/content/banking/financialstatus/FinancialComposite/FinancialStatus.xhtml?$event=paymentTransaction&row=0&group=0", "account", "01.01.2022", "01.01.2023") [{'bdate': '30.12.2022', 'vdate': '3..

:+1:

grindsa commented 1 year ago

Can you please test with legacy_login=False option to use the new web-frontend?

legacy_login=True uses the old login method. Sorry for not being precisely enough.

chaoslion commented 1 year ago

No worries, i tested both. The only difference is that the name of my 2FA device is shown with legacy off:

>>> from dkb_robo import DKBRobo
>>> dkb = DKBRobo("user", "pass", legacy_login=False)
>>> dkb.__enter__()
check your banking app on "DKB-App auf xyz" and confirm login...
<dkb_robo.dkb_robo.DKBRobo object at 0x7f03d2600160>
>>> dkb.account_dic
{0: {'name': '...
grindsa commented 1 year ago

If the name of the 2FA is the only difference you noticed my code works as expected :-) Thank you for your confirmation...

grindsa commented 1 year ago

Enhanced the code by an option to select the 2FA device from a list:

Pick an authentication device from the below list:
[0] - DKB-App on Google Pixel 6
[1] - DKB-App on iPad
:0

In case you have a chance please test this as well.

chaoslion commented 1 year ago

Unfortunately i only have one device :(. Maybe somebody else could help out!