I'm a very experienced developer in other fields -- but completely new to Shopify & ShopifySharp. Please don't bite if this is a dumb question - I've been searching for an answer for several hours and am out of ideas.
I'm following the example C# ShopifySharp code here:
Retrieving a customer
var service = new CustomerService(myShopifyUrl, shopAccessToken);
var customer = await service.GetAsync(customerId);
I am trying to find the right value to pass in as shopAccessToken.
The trouble is, the instructions here https://nozzlegear.com/shopify/generating-shopify-authorization-credentials show this screenshot of the Shopify App admin page:
But this does not match what I see in my admin page at https://partners.shopify.com/[PARTNERNUMBER]/apps/[APPNUMBER]/edit:
I've tried passing in the "API secret key" but this (predictably) threw an exception saying the token was wrong.
I've looked really hard for how to generate an access token and all I've found is something relevant to building a PHP web app (I think) here:
But I'm developing from C# and just want to use the ShopifySharp API directly (to upload Customers, Items and historical Orders & Transactions).
So I'm out of ideas.
How can I generate the token I need? What I am not understanding here?
As I said I'm a newbie on Shopify programming so any guidance would be warmly received.
Solved! Go to the solution
I haven't used this before, but according to their documentation this should work for private apps (which is what it looks like you're trying to use):
var service = new ShopifySharp.OrderService("mydomain.myshopify.com", "PRIVATE APP PASSWORD HERE").
Can you confirm you're not adding an http:// or https:// to your shopify domain? You're also probably better off raising this as a github issue or doing a search for issues within that repo.
I have double-checked my C# code and I have:
string myShopifyUrl = "[SHOPNAME].myshopify.com"; // NO http: or https: prefix
string shopAccessToken = "[32CHARACTERCODE]"; // have tried several variants (different codes from different part of my Shopify private app's details
Actual values of [SHOPNAME] and [32CHARACTERCOD] obfuscated here for privacy.
The error message I get is:
ShopifyException: (401 Unauthorized) [API] Invalid API key or access token (unrecognized login or wrong password)