Closed danielniccoli closed 4 years ago
Primarily because login is not guaranteed to be single step - 2FA would make cli, _ := PasswordLogin("http://localhost:8008", "alice", "wonderland")
not work as you'd need to have code in the middle to handle additional authentication. We don't know at compile time which servers will require additional steps, so the API has to be contorted to handle that. It's also just more consistent request/response pairings since currently this library is mainly an HTTP wrapper.
I'm still very new to Go and gomatrix, so please excuse my question if it sounds silly.
If I want to login, why do I need to instantiate NewClient with empty userID and accessToken and then proceed to SetCredentials?
Login is the first thing you must do (if you not already know the token). Why not have Login return a client with userid and access_token already set?
Something like:
Instead of: