Ich stehe mit ernsthaften Problem mit Shopify während Web-Anfrage, um Bestellliste von meiner Anwendung zu erhalten, während ich mit Direkttreffer auf Browser in Ordnung bin.Shopify - 401 Fehler während Webrequest
hier ist der Code:
private const string APIKey = "[DELETED]";
private const string APIPassword = "[DELETED]";
private const string APISecrateKey = "[DELETED]";
private const string StoreName = "epronto-2";
private const string OrderURL = "https://" + APIKey + ":" + APIPassword + "@" + StoreName + ".myshopify.com/admin/orders.json";
public string gethttpResponse(){
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "GET";
req.ContentType = "application/json";
req.Headers.Add("X-Shopify-Access-Token", APISecrateKey);
string text = string.Empty;
try{
var response = (HttpWebResponse)req.GetResponse();
using (var sr = new StreamReader(response.GetResponseStream()))
{
text = sr.ReadToEnd();
}
}
catch{}
return text;
}
können Sie bitte vorschlagen, was ich hier fehlt.
Was ich versucht habe:
tatsächlich, erhalte ich Daten aus dem privaten App, ich lese viele Artikel und fand dort keine für permanente access_token via OAuth API erforderlich ist,
so habe ich req.Headers.Add ("X-Shopify-Access-Token", APISecrateKey); diese Linie, aber ich konnte nicht für mich arbeiten.