You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Set access_token and user_id after login in with username and password.
This commit is contained in:
@@ -277,7 +277,21 @@ MatrixBaseApis.prototype.loginWithPassword = function(user, password, callback)
|
|||||||
return this.login("m.login.password", {
|
return this.login("m.login.password", {
|
||||||
user: user,
|
user: user,
|
||||||
password: password,
|
password: password,
|
||||||
}, callback);
|
}, (error, response) => {
|
||||||
|
if (response && response.access_token) {
|
||||||
|
this._http.opts.accessToken = response.access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response && response.user_id) {
|
||||||
|
this.credentials = {
|
||||||
|
userId: response.user_id,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if(callback) {
|
||||||
|
callback(error, response);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user