{"action":"closed","issue":{"url":"https://api.github.com/repos/realm/realm-js/issues/2155","repository_url":"https://api.github.com/repos/realm/realm-js","labels_url":"https://api.github.com/repos/realm/realm-js/issues/2155/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-js/issues/2155/comments","events_url":"https://api.github.com/repos/realm/realm-js/issues/2155/events","html_url":"https://github.com/realm/realm-js/issues/2155","id":386082906,"node_id":"MDU6SXNzdWUzODYwODI5MDY=","number":2155,"title":"Cannot serialize + deserialize an admin token user","user":{"login":"kraenhansen","id":1243959,"node_id":"MDQ6VXNlcjEyNDM5NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/1243959?v=4","gravatar_id":"","url":"https://api.github.com/users/kraenhansen","html_url":"https://github.com/kraenhansen","followers_url":"https://api.github.com/users/kraenhansen/followers","following_url":"https://api.github.com/users/kraenhansen/following{/other_user}","gists_url":"https://api.github.com/users/kraenhansen/gists{/gist_id}","starred_url":"https://api.github.com/users/kraenhansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kraenhansen/subscriptions","organizations_url":"https://api.github.com/users/kraenhansen/orgs","repos_url":"https://api.github.com/users/kraenhansen/repos","events_url":"https://api.github.com/users/kraenhansen/events{/privacy}","received_events_url":"https://api.github.com/users/kraenhansen/received_events","type":"User","site_admin":false},"labels":[{"id":247475509,"node_id":"MDU6TGFiZWwyNDc0NzU1MDk=","url":"https://api.github.com/repos/realm/realm-js/labels/T:Bug","name":"T:Bug","color":"eb6420","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-30T08:19:56Z","updated_at":"2018-11-30T11:13:39Z","closed_at":"2018-11-30T11:13:39Z","author_association":"CONTRIBUTOR","body":"## Goals\r\n\r\nDeserializing and serializing a user authenticated with an admin token.\r\n\r\nThis is the root cause of https://github.com/realm/realm-studio-private/issues/19.\r\n\r\n## Expected Results\r\n\r\nSerializing followed by deserializing should yield a user with the same property values.\r\n\r\n## Actual Results\r\n\r\nThe `isAdminToken` property is forgotten when serializing and disregarded when deserializing.\r\n\r\n## Steps to Reproduce & Code Sample\r\n\r\n```javascript\r\n// Create a user from an admin token\r\nconst user = Realm.Sync.User.login(\r\n    'http://localhost:9080',\r\n    Realm.Sync.Credentials.adminToken('...'),\r\n);\r\n\r\n// Notice how it has `isAdminToken == true`\r\nconsole.log(user.isAdminToken); // prints true\r\n\r\n// This gets forgotten when serializing the user\r\nconst serialized = user.serialize();\r\nconsole.log(serialized.isAdminToken); // prints undefined\r\n\r\n// Even if we fake it by setting the value it's disregarded when deserializing\r\nserialized.isAdminToken = true;\r\nconst reserialized = Realm.Sync.User.deserialize(serialized);\r\nconsole.log(reserialized.isAdminToken); // prints undefined\r\n```\r\n\r\nI created a branch with a failing test https://github.com/realm/realm-js/tree/kh/serialize-deserialize-admin-token\r\n\r\n## Version of Realm and Tooling\r\n\r\n- Realm JS SDK Version: 2.19.1\r\n- Node or React Native: N/A\r\n- Client OS & Version: N/A\r\n- Which debugger for React Native: N/A\r\n"}}
{"actor":{"display_login":"nirinchev"}}