angelol / erste-bank-client Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
With the mandatory switch to 2fa login and the removal of the password for authentication, I've been looking in to how to support this in this program.
The initial login request is easy enough to do:
url = 'https://login.sparkasse.at/sts/oauth/authorize?response_type=token&client_id=georgeclient'
r = s.get(url)
r = s.post(url, data={
'j_username': username,
'javaScript': 'jsOK',
'SAMLRequest': 'ignore',
})
match = re.search(r"Verification code: <b>(.*)</b>", r.text)
if match:
code = match.groups()[0]
print("Verification code: {}".format(code)
Where username
is the Verfügernummer.
You then can poll with a GET request to https://login.sparkasse.at/sts/secapp/secondfactor?client_id=georgeclient
, which returns a response like so:
{"secondFactorStatus": "PENDING", "pollingIntervalMs": 2500}
And after the 2fa signing is complete:
{"secondFactorStatus": "DONE"}
Here is a simple loop for polling:
def check_2fa(s):
url = "https://login.sparkasse.at/sts/secapp/secondfactor?client_id=georgeclient&response_type=code"
r = s.get(url, allow_redirects=False)
return j.json()
def poll(s):
while True:
j = check_2fa(s)
if j is None:
return False
if j['secondFactorStatus'] == 'ERROR':
return False
if j['secondFactorStatus'] == 'PENDING':
ms = int(j['pollingIntervalMs']) + 500
sec = ms / 1000
time.sleep(sec)
elif j['secondFactorStatus'] == 'DONE':
return True
else:
return False
After the secondfactor endpoint reports DONE
, then make a get request:
url = 'https://login.sparkasse.at/sts/oauth/authorize?response_type=token&client_id=georgeclient'
r = s.get(url, allow_redirects=False)
And the access token is in the Location header like before.
Hi,
I am interested in adding a few new features, but cannot find any info on the George API. Could you point me in the right direction?
Kind regards
Christian
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.