Ejemplo n.º 1
0
        private void ObtainAuthorisation()
        {
            string clientId = ConfigurationManager.AppSettings["ClientId"];
            string scope = ConfigurationManager.AppSettings["Scope"];

            if (authResult == null)
            {
                using (OAuthClient client = new OAuthClient(clientId))
                {
                    try
                    {
                        //If you have problems connecting try setting the IWebProxy
                        //in the call to client.Authorise below.
                        authResult = client.Authorise(new AuthorisationInfo() { Scope = scope });

                        //Allow tokens to be used if token was returned.
                        btnUseToken.Enabled = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }