コード例 #1
0
        /// <summary>
        /// When you have authorized our application in Podio - you can use the code that podio returns.
        /// </summary>
        public async Task <ActionResult> HandleAuthorizationResponse(string code, string error_reason, string error, string error_description)
        {
            //If error is empty, that means the authrization is succesfull and the authrization code returns
            if (string.IsNullOrEmpty(error) && !string.IsNullOrEmpty(code))
            {
                var authInfo = await PodioClient.AuthenticateWithAuthorizationCode(code, RedirectUrl);

                Session["UserId"] = authInfo.Ref.Id;
                return(RedirectToAction("Index", "Leads"));
            }
            else
            {
                TempData["podioError"] = error;
            }
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public async Task <ActionResult> UsernamePasswordAuthentication(UsernamePasswordAuthenticationViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var authInfo = await PodioClient.AuthenticateWithPassword(model.Username, model.Password);

                    Session["UserId"] = authInfo.Ref.Id;

                    return(RedirectToAction("Index", "Leads"));
                }
                catch (PodioException ex)
                {
                    TempData["podioError"] = ex.Error.ErrorDescription;
                }
            }

            return(View("Index"));
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: mvadstrup/PodioNET
        static void Main(string[] args)
        {
            var client = new PodioClient();

            var connected = client.Authenticate("podiousername", "password");

            Console.WriteLine("Is connected: " + connected);

            var request = new RestRequest();
            request.Method = Method.GET;
            request.RequestFormat = DataFormat.Json;
            request.Resource = "/file//";

            var file = client.RestExecute<List<PodioFile.FileResponse>>(request);

            foreach (var fileResponse in file)
            {
                Console.Write(fileResponse.Name);
            }
        }
コード例 #4
0
 /// <summary>
 /// Start server side flow
 ///  For more details see : https://developers.podio.com/authentication/server_side
 /// </summary>
 public void ServerSideAuthentication()
 {
     Response.Redirect(PodioClient.GetAuthorizeUrl(RedirectUrl));
 }