diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/authtypes/device.go b/src/github.com/matrix-org/dendrite/clientapi/auth/authtypes/device.go index d9f2a4e06..a6d3a7b08 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/authtypes/device.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/authtypes/device.go @@ -16,6 +16,7 @@ package authtypes // Device represents a client's device (mobile, web, etc) type Device struct { + ID string UserID string // The access_token granted to this device. // This uniquely identifies the device from all other devices and clients. diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go index 203e9ebef..0aeb3cf81 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/devices_table.go @@ -88,6 +88,7 @@ func (s *devicesStatements) insertDevice(txn *sql.Tx, id, localpart, accessToken createdTimeMS := time.Now().UnixNano() / 1000000 if _, err = s.insertDeviceStmt.Exec(id, localpart, accessToken, createdTimeMS); err == nil { dev = &authtypes.Device{ + ID: id, UserID: makeUserID(localpart, s.serverName), AccessToken: accessToken, } @@ -103,7 +104,7 @@ func (s *devicesStatements) deleteDevice(txn *sql.Tx, id, localpart string) erro func (s *devicesStatements) selectDeviceByToken(accessToken string) (*authtypes.Device, error) { var dev authtypes.Device var localpart string - err := s.selectDeviceByTokenStmt.QueryRow(accessToken).Scan(&localpart) + err := s.selectDeviceByTokenStmt.QueryRow(accessToken).Scan(&dev.ID, &localpart) if err != nil { dev.UserID = makeUserID(localpart, s.serverName) dev.AccessToken = accessToken