abertschi / postcards

A CLI for the Swiss Postcard Creator :postbox:
https://abertschi.ch/blog/2022/receiving-postcards/
MIT License
36 stars 8 forks source link

swissid username password authentication failed #58

Closed Flo3561 closed 2 years ago

Flo3561 commented 2 years ago

Hi @abertschi, I somehow have an issue to login with swissid. Was the swissid login tested with two factor authentication? BR Flo3561

postcards (INFO): postcards 2.2 with postcard-creator 2.2
postcards (INFO): reading config file at /root/config.json
postcards (INFO): checking for valid accounts
postcard_creator (INFO): using legacy username password authentication
postcard_creator (INFO): legacy username password authentication failed
postcard_creator (INFO): Failed to parse: https://pccweb.api.post.ch/OAuth/authorization?client_id=ae9b9894f8728ca78800942cda638155&response_type=code&redirect_uri=ch.post.pcc%3A%2F%2Fauth%2F1016c75e-aa9c-493e-84b8-4eb3ba6177ef&scope=PCCWEB+offline_access&response_mode=query&state=abcd&code_challenge=PYWwxxx&code_challenge_method=S256&lang=en
postcard_creator (INFO): Trying swissid now because method=legacy
postcard_creator (INFO): using swissid username password authentication
postcard_creator (INFO): swissid username password authentication failed
postcard_creator (INFO): Failed to parse: https://pccweb.api.post.ch/OAuth/authorization?client_id=ae9b9894f8728ca78800942cda638155&response_type=code&redirect_uri=ch.post.pcc%3A%2F%2Fauth%2F1016c75e-aa9c-493e-84b8-4eb3ba6177ef&scope=PCCWEB+offline_access&response_mode=query&state=abcd&code_challenge=iqyxxx&code_challenge_method=S256&lang=en
abertschi commented 2 years ago

What is the second factor? I am not aware of such feature in swissid. Enabling 2FA would not make much sense for postcards if the second factor is a code via SMS.

abertschi commented 2 years ago

In order to isolate your issue, can you disable 2FA and try again?

Flo3561 commented 2 years ago

Thanks for the fast reply. There are multiple methods by SwissID available (SwissID App / Mobile ID / SMS / Streichliste). I used the SwissID App and I just gave it a retry with it disabled. It still seems to be not working. It looks like the SMS code is now used as 2FA method which is also set in my SwissID profile but somehow cannot be deactivated anymore. Probably I need to give it a retry with a fresh new account...

abertschi commented 2 years ago

Having 2FA which requires a human in the loop defeats the purpose of having an API wrapper to programmatically interact with the Swiss Post APIs. If you choose to use 2FA, you may rather use the official mobile apps by the Swiss Post. Let me know if the issue persists without 2FA.