I am using the JOSM version 18678.
I tried OAuth 2.0, it works for my normal account.
But when I want to change to my import account, I don’t know how to change the username in OAuth 2.0.
In OAuth 1.0a, I can change my user account.
How/where change the user account in OAuth 2.0 of JOSM?
There is #2710 ([WIP Patch] The preferences should have multiple server profiles) – JOSM but for now, you have to either use different JOSM profiles for each account or always change your credentials by removing the old and retrieving the new token. For the later, just make sure that you are logged out on https://www.openstreetmap.org or logged in with the account you want to retrieve the token for.
Thank you for your advice.
I logged out from openstreetmap.org with the browser and logged in again with another account. After I removed the token and re-authenticated it again on the JOSM, I could change the user account in the JOSM.
It takes more steps than OAuth 1.0 …
This is partly due to the best practices for OAuth 2.0 specifically recommending against entering passwords into non-browser applications (in other words, we shouldn’t have the user enter their username and password into JOSM). OAuth 1.0 had a fully-automatic flow which did precisely that, and while we could have kept that workflow, I felt that it was a bad idea from a security perspective.
Yes that was never a good idea and it’s exactly what caused Maps.me to break because it was trying to fill in forms automatically.
There is in fact a new proposal to specifically prohibit such behaviour.