- We now use /whoami to validate the auth token since it gives us the user_id and device_id for the given auth_token (device_id is only available on Synapse 1.40 onwards)
- Error is now thrown if device_id cannot be automatically detected
- Do not store `null` into my_device_id and ignore if it has already been set. Fixes#51
node.log(`Saving Device ID (old:${stored_device_id} new:${device_id})`);
storeDeviceId(localStorage,device_id);
}
// update device label
if(node.deviceLabel){
node.matrixClient
.getDevice(device_id)
.then(
function(response){
if(response.display_name!==node.deviceLabel){
node.matrixClient.setDeviceDetails(device_id,{
display_name:node.deviceLabel
}).then(
function(response){},
function(error){
node.error("Failed to set device label: "+error);
}
);
if(!device_id&&node.enableE2ee){
node.error("Failed to auto detect deviceId for this auth token. You will need to manually specify one. You may need to login to create a new deviceId.")
node.error("/whoami request did not return device_id. You will need to manually set one in your configuration because this cannot be automatically fetched.");