famedly / matrix-dart-sdk

Matrix SDK written in pure Dart.
GNU Affero General Public License v3.0
62 stars 33 forks source link

Refactor Login method #1748

Open famedly-bot opened 2 years ago

famedly-bot commented 2 years ago

In GitLab by @krille-chan on Jan 17, 2022, 08:17

The current login method only allows "m.login.password" and "m.login.type" as login types which is enforced by an enum. The Famedly UIA proxy expects a custom type which is impossible to set. What about we change the login method that it is just like in the api, so the type would be a String and so on. Then in the SDK we create two additional login methods, so we would have:

/// API login method which just allows everything (including UIA)
Future<LoginResponse> login({/* lots of attributes */});

/// Simplified with just username and password
Future<void> loginWithPassword(String username, String password, {auth});

/// Simplified just with token
Future<void> loginWithToken(String token, {auth});
famedly-bot commented 2 years ago

In GitLab by @krille-chan on Jan 17, 2022, 08:18

mentioned in issue undefined##undefined

famedly-bot commented 2 years ago

In GitLab by @ffpetrovic on Jan 22, 2022, 19:56

Hi, I'm guessing this would allow for the, now unsupported, m.login.jwt LoginType? Do you have a very rough estimate of when this could be done? Thank you :heart:

famedly-bot commented 2 years ago

In GitLab by @nikzen on Oct 4, 2022, 15:54

mentioned in issue undefined##undefined

famedly-bot commented 2 years ago

In GitLab by @dubutx on Oct 5, 2022, 13:57

To support m.login.jwt org.matrix.login.jwt, it's as simple as this https://github.com/huangred/matrix_api_lite/compare/prod

Then use this to login

await _client.login(LoginType.mLoginJWT, token: accessToken);
famedly-bot commented 2 years ago

In GitLab by @supermar10 on Oct 15, 2022, 13:05

@ffpetrovic I just forked the project added the "LoginType.mLoginJWT", and I'm now using my forked version by overriding the dependency manually and pulling the code from gitlab like so:

dependency_overrides:
  matrix_api_lite:
    git:
      url: https://gitlab.com/supermar10/matrix_api_lite.git
      ref: supermar10/add-login-type-jwt
PhantomRay commented 9 months ago

Hi there, we have being using JWT to authenticate users for more than 1 year now. However we use modified version to support it. Can you guys please add this support to this repo. I know this repo is going to be merged with matrix SDK soon. The following code is basically the same has @huangred.

https://github.com/PhantomRay/dart_matrix_api_lite/commit/44def7cd6cbf7ccb2503fa9405386e0194aeedb6

PhantomRay commented 6 months ago

PR created https://github.com/famedly/matrix-dart-sdk/pull/1774