Example #1
0
        /// <summary>
        /// Login with a given username and password.
        /// Currently, this is the only login method the SDK supports.
        /// </summary>
        /// <param name="username">Username</param>
        /// <param name="password">Password</param>
        public MatrixLoginResponse LoginWithPassword(string username, string password)
        {
            var result = api.ClientLogin(new MatrixLoginPassword(username, password));

            api.SetLogin(result);
            return(result);
        }
Example #2
0
 /// <summary>
 /// Use existing login information when connecting to Matrix.
 /// </summary>
 /// <param name="user_id">Full Matrix user id.</param>
 /// <param name="access_token">Access token.</param>
 /// <param name="refresh_token">Refresh token.</param>
 public void UseExistingToken(string user_id, string access_token, string refresh_token = null)
 {
     api.SetLogin(new MatrixLoginResponse()
     {
         user_id       = user_id,
         access_token  = access_token,
         refresh_token = refresh_token,
         home_server   = api.BaseURL
     });
     api.ClientSync();
     api.StartSyncThreads();
 }