1
0
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:
Richard Lewis
2018-11-04 19:43:18 +00:00
parent 68c6393eb2
commit 394e37f9ea

View File

@@ -277,7 +277,21 @@ MatrixBaseApis.prototype.loginWithPassword = function(user, password, callback)
return this.login("m.login.password", {
user: user,
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);
}
});
};
/**