Example #1
0
        public async static Task <ResponseModel> GitCallback(RedirectBack redirect)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                var Callback = new RedirectBack();
                using (var httpClient = new HttpClient())
                {
                    StringContent content = new StringContent(JsonConvert.SerializeObject(redirect), Encoding.UTF8, "application/json");
                    using (var re = await httpClient.PostAsync(TokenEndpoint, content))
                    {
                        string apiResponse = await re.Content.ReadAsStringAsync();

                        response.Data = apiResponse;
                        //Callback = JsonConvert.DeserializeObject<RedirectBack>(apiResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }
            return(response);
        }
Example #2
0
        public async Task <ResponseModel> CallBackToSite(RedirectBack redirect)
        {
            response.Success = false;
            try
            {
                response = await CommonGitService.GitCallback(redirect);

                if (response.Data != null)
                {
                    response.Success     = true;
                    response.Status_Code = 200;
                }
            }
            catch (Exception ex) { response.Message = ex.Message; }
            return(response);
        }
        //POST https://github.com/login/oauth/access_token
        public async Task <IActionResult> CallBackToSite(RedirectBack model)
        {
            ResponseModel response = await new GitInfo().CallBackToSite(model);

            return(Ok(response));
        }