public static async Task <UserBase> AcquireUserFromToken(TokenBase token) { try { switch (token.UserType) { case UserType.Google: var googleClient = new GoogleClient(token); return(await googleClient.GetUserDataAsync()); case UserType.Microsoft: var msClient = new MicrosoftClient(token); return(await msClient.GetUserDataAsync()); case UserType.NatureRemo: var remoClient = new NatureRemoClient(token); return(await remoClient.GetUserDataAsync()); case UserType.Hue: return(await HueAuthClient.FindHueBridge(token)); default: break; } } catch (Exception ex) { Debugger.WriteErrorLog("Exception occured on acquiring user info. Type=" + token.UserType.ToString(), ex); //var message = new MessageDialog("Type=" + token.UserType.ToString() + " Exception=" + ex.Message, "Exception occured on acquiring user info."); //await message.ShowAsync(); var user = new UserBase(); user.Token = token; user.UserType = token.UserType; user.UserName = "******"; user.ProfilePictureUrl = "/Assets/Square150x150Logo.scale-200.png"; user.Id = token.Id; return(user); } return(null); }