Пример #1
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(Redirect("/"));
            }

            var tokenData = await SmartMeOAuthConfiguration.GetAccessToken(HttpContext);

            return(await UserApi.GetUserAsync(
                       tokenData.AccessToken,
                       new ResultHandler <SmartMeApiClient.Containers.User>
            {
                OnSuccess = (userInfo) =>
                {
                    UserInfo = userInfo;
                    return Page();
                },

                OnError = DefaultErrorHandler.Handle
            }
                       ));
        }
        public async Task <IActionResult> OnGetAsync()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(Redirect("/"));
            }

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            return(await UserApi.GetUserAsync(
                       accessToken,
                       new ResultHandler <SmartMeApiClient.Containers.User>
            {
                OnSuccess = (userInfo) =>
                {
                    UserInfo = userInfo;
                    return Page();
                },

                OnError = DefaultErrorHandler.Handle
            }
                       ));
        }