Пример #1
0
        public static String getAuthenticateUrl(out String sessionId)
        {
            sessionId = "";

            ApiAccount apiAccount = new ApiAccount();

            apiAccount.Application = EbayAppId;
            apiAccount.Certificate = EbayCertId;
            apiAccount.Developer   = EbayDevId;

            ApiContext localContext = new ApiContext();

            localContext.ApiCredential            = new eBay.Service.Core.Sdk.ApiCredential();
            localContext.ApiCredential.ApiAccount = apiAccount;
            localContext.RuName           = EbayRuName;
            localContext.SoapApiServerUrl = System.Configuration.ConfigurationManager.AppSettings.Get(AppSettingHelper.API_SERVER_URL);
            localContext.SignInUrl        = System.Configuration.ConfigurationManager.AppSettings.Get(AppSettingHelper.SIGNIN_URL);

            GetSessionIDCall apiCall = new GetSessionIDCall(localContext);

            apiCall.RuName = EbayRuName;
            apiCall.Execute();

            sessionId = apiCall.SessionID;
            String authUrl = String.Format("{0}&RuName={1}&SessID={2}", localContext.SignInUrl, EbayRuName, sessionId);

            return(authUrl);
        }
Пример #2
0
        public static string GetSessionID()
        {
            ApiContext       context = AppSettingHelper.GetGenericApiContext("US");
            GetSessionIDCall calla   = new GetSessionIDCall(context);

            return(calla.GetSessionID(context.RuName));
        }
Пример #3
0
        private void BtnGenerateSID_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (!validateApiAccount(Context))
                {
                    MessageBox.Show("Pleasse fill in Api Account first.");
                    return;
                }

                GetSessionIDCall gsc = new GetSessionIDCall(Context);
                if (txtRulName.Text == string.Empty)
                {
                    MessageBox.Show("Please input a RuName");
                    return;
                }
                //the rule name can be retrived from the app.config file, otherwise the user must input it himself.

                Context.RuName = txtRulName.Text;
                String sessionID = gsc.GetSessionID(Context.RuName);
                TxtSessionID.Text = sessionID;
            }
            catch (ApiException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #4
0
        public string GetRequestTokenUrl()
        {
            GetSessionIDCall gsc       = new GetSessionIDCall(api);
            string           sessionid = gsc.GetSessionID(Runname);

            SessionID = sessionid;

            return(string.Format(Redirecturl, Runname, sessionid));
        }
Пример #5
0
        /// <summary>
        /// Gets the session identifier.
        /// </summary>
        /// <returns></returns>
        public Task <string> GetSessionId()
        {
            GetSessionIDCall getSessionIdCall = new GetSessionIDCall(GetContext());

            getSessionIdCall.EnableCompression = true;
            getSessionIdCall.Site = SiteCodeType.UK;

            return(Task.Run(() => getSessionIdCall.GetSessionID(Config.RuName)));
        }
Пример #6
0
        public EbayServiceResponse <string> GetSignInUrl()
        {
            var apiContext = CreateApiContext(apiServerUrl, ruName, appId, devId, certId);
            var result     = new EbayServiceResponse <string>();

            try
            {
                GetSessionIDCall sidCall   = new GetSessionIDCall(apiContext);
                string           sessionId = sidCall.GetSessionID(apiContext.RuName);
                result.Result = signinUrl + "&RuName=" + apiContext.RuName + "&SessID=" + HttpUtility.UrlEncode(sessionId);
            }
            catch (Exception ex)
            {
                result.Error = ex.Message;
            }
            return(result);
        }
Пример #7
0
        // Test API
        // https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx

        public static string CreateSessionID(ApiContext apiContext)
        {
            GetSessionIDCall sessionId = new GetSessionIDCall(apiContext);

            sessionId.RuName = ConfigurationManager.AppSettings["RuName"];
            sessionId.ApiContext.ApiCredential.ApiAccount.Application = ConfigurationManager.AppSettings["AppID"];
            sessionId.ApiContext.ApiCredential.ApiAccount.Developer   = ConfigurationManager.AppSettings["DevID"];
            sessionId.ApiContext.ApiCredential.ApiAccount.Certificate = ConfigurationManager.AppSettings["CertID"];
            sessionId.Execute();
            apiContext.ApiLogManager.RecordMessage(String.Format("*** Session ID: {0}", sessionId.SessionID));
            string uri = String.Format("https://signin.sandbox.ebay.com/ws/eBayISAPI.dll?SignIn&RuName={0}&SessID={1}",
                                       ConfigurationManager.AppSettings["RuName"], sessionId.SessionID);

            apiContext.ApiLogManager.RecordMessage(String.Format("*** URL: {0}", uri));

            uri = String.Format("https://signin.sandbox.ebay.com/ws/eBayISAPI.dll?SignIn&RuName={0}&SessID={1}",
                                ConfigurationManager.AppSettings["RuName"], HttpUtility.UrlEncode(sessionId.SessionID));
            apiContext.ApiLogManager.RecordMessage(String.Format("*** URL encoded: {0}", uri));
            return(sessionId.SessionID);
        }
Пример #8
0
        public static EbayAuthRequest CreateNewAuthRequest()
        {
            var client = EbayClientHelper.GetSdkClient();
            var call   = new GetSessionIDCall(client);

            var service = new WebServices.eBayService.eBayAPIInterfaceService();

            var sessionId           = call.GetSessionID(EbaySettings.RuName);
            var urlEncodedSessionID = sessionId; //System.Net.WebUtility.UrlEncode(sessionId);
            var loginUrl            = string.Format("https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame={0}&SessID={1}", EbaySettings.RuName, urlEncodedSessionID);
            var data = new EbayAuthRequest
            {
                SessionId = sessionId,
                LoginUrl  = loginUrl
            };

            log.Debug($"Created New Auth Request: {data}");

            return(data);
        }