{"id":39224,"date":"2019-08-01T14:04:44","date_gmt":"2019-08-01T19:04:44","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/appcenter\/?p=39224"},"modified":"2019-08-01T14:09:14","modified_gmt":"2019-08-01T19:09:14","slug":"visual-studio-app-center-user-identity-shared-devices","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/appcenter\/visual-studio-app-center-user-identity-shared-devices\/","title":{"rendered":"Visual Studio\u00a0App Center, User Identity, &#038;\u00a0Shared Devices\u00a0"},"content":{"rendered":"<p><span data-contrast=\"auto\">One of the design goals for the\u00a0<\/span><span data-contrast=\"auto\">Visual Studio\u00a0<\/span><span data-contrast=\"auto\">App Center SDK\u00a0<\/span><span data-contrast=\"auto\">is<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">to\u00a0<\/span><span data-contrast=\"auto\">simplif<\/span><span data-contrast=\"auto\">y<\/span><span data-contrast=\"auto\">\u00a0things for developers, making it easy for them to use App Center in their mobile (and desktop) apps.<\/span><span data-contrast=\"auto\">\u00a0Because of this, the SDK does a lot of work for developers<\/span><span data-contrast=\"auto\">, especially at startup whenever the app lets the SDK know which App Center services are in play.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">When the SDK starts up and the app registers the App Center services it wants to use the SDK automatically initializes each service\u00a0<\/span><span data-contrast=\"auto\">in the app, but also\u00a0<\/span><span data-contrast=\"auto\">initializes the service\u00a0<\/span><span data-contrast=\"auto\">on the App Center backend as well.\u00a0<\/span><span data-contrast=\"auto\">In\u00a0<\/span><span data-contrast=\"auto\">general,<\/span><span data-contrast=\"auto\">\u00a0this means\u00a0<\/span><span data-contrast=\"auto\">sending information about the app and device\u00a0<\/span><span data-contrast=\"auto\">to App Center for processing<\/span><span data-contrast=\"auto\">\u00a0\u2013 whatever that may be<\/span><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">When we added support for<\/span><span data-contrast=\"auto\">\u00a0setting user identity (either using the App Center Auth service or the App Center SDK)<\/span><span data-contrast=\"auto\">, this creates some potential complications<\/span><span data-contrast=\"auto\">\u00a0for developers to consider as they build their apps.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">No matter\u00a0<\/span><span data-contrast=\"auto\">how\u00a0<\/span><span data-contrast=\"auto\">your app sets user identity, it\u2019s possible for the app to be in multiple s<\/span><span data-contrast=\"auto\">tates<\/span><span data-contrast=\"auto\">\u00a0as far as App Center is concerned. For example,\u00a0<\/span><span data-contrast=\"auto\">assuming you\u2019re using the App Center Analytics, Diagnostics, and Push services in your app<\/span><span data-contrast=\"auto\">\u00a0&#8211;\u00a0<\/span><span data-contrast=\"auto\">before you\u00a0<\/span><span data-contrast=\"auto\">identify\u00a0<\/span><span data-contrast=\"auto\">the<\/span><span data-contrast=\"auto\">\u00a0app user<\/span><span data-contrast=\"auto\">\u00a0(<\/span><span data-contrast=\"auto\">using\u00a0<\/span><span data-contrast=\"auto\">the\u00a0<\/span><span data-contrast=\"auto\">Auth service or set using the App Center SDK)<\/span><span data-contrast=\"auto\">, the following happens:<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">T<\/span><span data-contrast=\"auto\">he app<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">send<\/span><span data-contrast=\"auto\">s<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">a<\/span><span data-contrast=\"auto\">nalytics\u00a0<\/span><span data-contrast=\"auto\">data to App Center for processing<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;335559739&quot;:120}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">If the app crashes, the\u00a0<\/span><span data-contrast=\"auto\">SDK<\/span><span data-contrast=\"auto\">\u00a0sends d<\/span><span data-contrast=\"auto\">iagnostics data to App Center for processing<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;335559739&quot;:120}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">The SDK registers the device to receive notifications<\/span><span data-contrast=\"auto\">\u00a0(first it gets a push token from the platform notification service, then sends it to App Center so it can send to the device later)<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;335559739&quot;:120}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">This data sits in App Center without being associated with any user.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">When\u00a0<\/span><span data-contrast=\"auto\">an app user logs into the app<\/span><span data-contrast=\"auto\">\u00a0or logs into the app\u2019s backend and the\u00a0<\/span><span data-contrast=\"auto\">app sets the user identity through the App Center SDK,\u00a0<\/span><span data-contrast=\"auto\">App Center ensures\u00a0<\/span><span data-contrast=\"auto\">that all future data sent to App Center is\u00a0<\/span><span data-contrast=\"auto\">now\u00a0<\/span><span data-contrast=\"auto\">associated with the provided user identity.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">At this point, there are\u00a0<\/span><span data-contrast=\"auto\">two sets of data in\u00a0<\/span><span data-contrast=\"auto\">App Center,\u00a0<\/span><span data-contrast=\"auto\">the early,\u00a0<\/span><span data-contrast=\"auto\">anonymous\u00a0<\/span><span data-contrast=\"auto\">data,\u00a0<\/span><span data-contrast=\"auto\">and\u00a0<\/span><span data-contrast=\"auto\">the data associated with<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">user<\/span><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Now, when\u00a0<\/span><span data-contrast=\"auto\">you\u2019re using App Center Push, and\u00a0<\/span><span data-contrast=\"auto\">an app is shared by multiple users on the same device (shared devices)<\/span><span data-contrast=\"auto\">\u00a0things can get a little wonky<\/span><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">When the app launches\u00a0<\/span><span data-contrast=\"auto\">with\u00a0<\/span><span data-contrast=\"auto\">P<\/span><span data-contrast=\"auto\">ush enabled<\/span><span data-contrast=\"auto\">, the SDK registers the device for Push<\/span><span data-contrast=\"auto\">\u00a0or refreshes\u00a0<\/span><span data-contrast=\"auto\">an existing device\u00a0<\/span><span data-contrast=\"auto\">registration<\/span><span data-contrast=\"auto\">. When the user logs in<\/span><span data-contrast=\"auto\">to the app<\/span><span data-contrast=\"auto\">,\u00a0<\/span><span data-contrast=\"auto\">App Center updates the\u00a0<\/span><span data-contrast=\"auto\">device\u00a0<\/span><span data-contrast=\"auto\">registration to associate the user with the device.<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">When a different user uses\u00a0<\/span><span data-contrast=\"auto\">the same<\/span><span data-contrast=\"auto\">\u00a0device, any push notifications sent to the previous user will be sent to that device<\/span><span data-contrast=\"auto\">\u00a0until sometime after the new user logs into the app on the device. When the new user logs in, the SDK updates the device registration with the new\u00a0<\/span><span data-contrast=\"auto\">user identity. Since it may take a little bit of time for the backend update to complete, there may be some overlap\u00a0<\/span><span data-contrast=\"auto\">after\u00a0<\/span><span data-contrast=\"auto\">the new user<\/span><span data-contrast=\"auto\">\u00a0logs in.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">To mitigate\u00a0<\/span><span data-contrast=\"auto\">potential\u00a0<\/span><span data-contrast=\"auto\">issues related to this:<\/span><span data-ccp-props=\"{&quot;335559739&quot;:120}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Never send confidential information to a<\/span><span data-contrast=\"auto\">\u00a0user using any push notification service.\u00a0<\/span><span data-contrast=\"auto\">Architect your app so it sends\u00a0<\/span><span data-contrast=\"auto\">a<\/span><span data-contrast=\"auto\">\u00a0s<\/span><span data-contrast=\"auto\">imple<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">notification<\/span><span data-contrast=\"auto\">\u00a0to the app\/device\/user\u00a0<\/span><span data-contrast=\"auto\">letting the app know there\u2019s new data. W<\/span><span data-contrast=\"auto\">hen the app reads the notification, it\u00a0<\/span><span data-contrast=\"auto\">uses existing logic in the app to connect to the backend server and request the updated data<\/span><span data-contrast=\"auto\">.\u00a0<\/span><span data-contrast=\"auto\">If the data is associated with a\u00a0<\/span><span data-contrast=\"auto\">specific\u00a0<\/span><span data-contrast=\"auto\">user,\u00a0<\/span><span data-contrast=\"auto\">force the user to login\u00a0<\/span><span data-contrast=\"auto\">to access the data.\u00a0<\/span><span data-contrast=\"auto\">With this<\/span><span data-contrast=\"auto\">\u00a0approach<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">and the appropriate access control mechanisms in place,\u00a0<\/span><span data-contrast=\"auto\">users\u00a0<\/span><span data-contrast=\"auto\">can\u2019t<\/span><span data-contrast=\"auto\">\u00a0see\u00a0<\/span><span data-contrast=\"auto\">another<\/span><span data-contrast=\"auto\">\u00a0user\u2019s notification data.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;335559739&quot;:120}\">\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Ensure\u00a0<\/span><span data-contrast=\"auto\">shared device app users know to logout of the application when they\u2019re finished with the device.<\/span><span data-contrast=\"auto\">\u00a0Or, even better, a<\/span><span data-contrast=\"auto\">utomatically log users out of the app when they\u2019ve been inactive for\u00a0<\/span><span data-contrast=\"auto\">some time<\/span><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;335559739&quot;:120}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">As you can see, t<\/span><span data-contrast=\"auto\">he user identity capabilities of App Center\u00a0<\/span><span data-contrast=\"auto\">enhance how you interact with your app users and allow you to more easily troubleshoot issues when they arise (by targeting data for the specific user). We\u2019ll continue to add capabilities to App Center to<\/span><span data-contrast=\"auto\">\u00a0enhance what you can do for your app users, if you have suggestions for future features, be sure to give them to us<\/span><span data-contrast=\"auto\">\u00a0through the\u00a0<\/span><a href=\"https:\/\/github.com\/Microsoft\/appcenter\"><span data-contrast=\"none\">App Center GitHub repository<\/span><\/a><span data-contrast=\"auto\">.\u00a0<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559739&quot;:120,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The user identity capabilities of App Center\u00a0enhance how you interact with your app users and allow you to more easily troubleshoot issues when they arise We\u2019ll continue to add capabilities to App Center to\u00a0enhance what you can do for your app users,<\/p>\n","protected":false},"author":1290,"featured_media":38034,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16],"tags":[],"class_list":["post-39224","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mobiledev"],"acf":[],"blog_post_summary":"<p>The user identity capabilities of App Center\u00a0enhance how you interact with your app users and allow you to more easily troubleshoot issues when they arise We\u2019ll continue to add capabilities to App Center to\u00a0enhance what you can do for your app users,<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/posts\/39224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/users\/1290"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/comments?post=39224"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/posts\/39224\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/media\/38034"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/media?parent=39224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/categories?post=39224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/tags?post=39224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}