protected void SetupCurrentUser(IDictionary <string, string> accountProperties)
        {
            var endpoint = string.Format(Auth0Constants.UserInfoEndpoint, Domain, accountProperties["access_token"]);

            var request = new Request("GET", new Uri(endpoint));

            request.GetResponseAsync().ContinueWith(t =>
            {
                try
                {
                    var text = t.Result.GetResponseText();

                    if (t.Result.StatusCode != HttpStatusCode.OK)
                    {
                        throw new InvalidOperationException(text);
                    }
                    accountProperties.Add("profile", text);
                }
                finally
                {
                    CurrentUser = new Auth0User(accountProperties);
                }
            }).Wait();
        }
示例#2
0
		private void ShowResult(Auth0User user)
		{
			var id = user.IdToken;
			var profile = user.Profile.ToString();
			var refreshToken = string.IsNullOrEmpty (user.RefreshToken) 
				? "Not requested. Use withRefreshToken: true when calling LoginAsync."
				: user.RefreshToken;

			var truncatedId = id.Remove (0, 20);
			truncatedId = truncatedId.Insert (0, "...");

			this.FindViewById<TextView>(Resource.Id.txtResult).Text = string.Format (
				"Id: {0}\r\n\r\nProfile: {1}\r\n\r\nRefresh Token:\r\n{2}", 
				truncatedId, 
				profile, 
				refreshToken);
		}