Пример #1
0
        public static string AuthorisationFlowPart2(string straccessToken, string appKey, string appSecret, string redirectUrl, string strCrossSiteScriptCheck)
        {
            try
            {
                redirectUrl = GetValidRedirectURL(redirectUrl);
                AuthorisationSettings authSettings = new AuthorisationSettings(appKey, appSecret, new Uri(redirectUrl), strCrossSiteScriptCheck);

                var authTask = AuthorizeApp.GetUserAuthorisationCode(straccessToken, authSettings);
                if (!authTask.IsCompleted)
                {
                    authTask.Wait();
                }
                if (authTask.Result != null)
                {
                    return(authTask.Result.ToString());
                }
            }
            catch (AggregateException ex)
            {
                foreach (Exception ie in ex.InnerExceptions)
                {
                    throw;
                }
            }

            return("");
        }
Пример #2
0
        // AuthorisationFlowPart1 funtion returns string array: redirect url string placed in first element and other element is error message (if any).
        public static string[] AuthorisationFlowPart1(string appKey, string appSecret, string redirectUrl, string strCrossSiteScriptCheck)
        {
            redirectUrl = GetValidRedirectURL(redirectUrl);

            AuthorisationSettings authSettings = new AuthorisationSettings(appKey, appSecret, new Uri(redirectUrl), strCrossSiteScriptCheck);

            return(AuthorizeApp.GetAuthorisationURL(authSettings));
        }