Shopify.NET API - Invalid request: Shopify API application does not support oauth

I'm trying to create a website, I can get all my information from my Shopify store using the API there.

I downloaded the .NET example from here and added my API key and secret key to the configuration file, when I run the test application after entering the name of my website it redirects me to the shopify.com control panel of my store, but I write on the screen "It looks like it happened mistake, "and he says that:

Invalid request: Shopify API application does not support oauth

I agree if anyone can ask for help and guide me to find the problem.

thanks

+4
source share
2 answers

Private applications do not need an OAuth access token for authentication, you can use a combination of api-key, password.

for ex: https: // API-KEY: PASSWORD@YOUR-TEST-SHOP.myshopify.com /admin/orders.xml

+4
source

According to Kobe, private applications are much simpler. Here is an example :

public string GetCustomers() { const string url = "https://your-store.myshopify.com/admin/customers.json"; var req = (HttpWebRequest)WebRequest.Create(url); req.Method = "GET"; req.ContentType = "application/json"; req.Credentials = GetCredential(url); req.PreAuthenticate = true; using (var resp = (HttpWebResponse)req.GetResponse()) { if (resp.StatusCode != HttpStatusCode.OK) { string message = String.Format("Call failed. Received HTTP {0}", resp.StatusCode); throw new ApplicationException(message); } var sr = new StreamReader(resp.GetResponseStream()); return sr.ReadToEnd(); } } private static CredentialCache GetCredential(string url) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; var credentialCache = new CredentialCache(); credentialCache.Add(new Uri(url), "Basic", new NetworkCredential("your-api-key", "your-password")); return credentialCache; } 

Obtain your credentials by going to http://your-store.myshopify.com/admin/apps and clicking on "Create API Private Key" below.

+3
source

Source: https://habr.com/ru/post/1489229/


All Articles