Skip to content

Problems with refresh_token() #16

@martinbannert

Description

@martinbannert

Hello, thanks so much for sharing this! It works really well so far, just using refresh_token() gives huzzles. After calling it, it might be that one or two following other API-calls still work, but then get a "401 - unauthorized" and need to re-authenticate with an M_TAN.
Your code looks perfectly fine and is following the spec, maybe it only works with P_TAN?

This is what I do, to test it:

I have an 'ini.py' file where I do the TAN-dance once and export the session:

from comdirect_api.comdirect_client import ComdirectClient
client = ComdirectClient(client_id, client_secret)
client.fetch_tan(userId, pin)
tan = input('Enter TAN:')
client.activate_session(tan)
client.session_export()

And then run it of the command-line python3 ini.py, which works fine.

Then I import the session in another file called 'main.js' and do some API-calls:

from comdirect_api.comdirect_client import ComdirectClient
client = ComdirectClient(client_id, client_secret, import_session=True)
balances = client.get_all_balances()
print(balances)

I can execute main.py flawlessly for the next ten minutes, before the token expires.
However whenever I add the line client.refresh_token() to main.py, the next one or two calls work, but then get 401.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions