I am trying to build a public app for shopify.
I have registered the app in my patners.shopify and have access to my Public and Secret API keys.
I have a django python script(end point in my views.py) as seen below
@csrf_exempt
@require_POST
def ShopifyCallbackUrl(request):
try:
API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
API_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
shopify.Session.setup(api_key=API_KEY, secret=API_SECRET)
shop_url = "xxxx-test-store.myshopify.com"
api_version = '2020-10'
state = binascii.b2a_hex(os.urandom(15)).decode("utf-8")
redirect_uri = "https://webhook.site/e12c1926-f47b-45b4-bc59-0a3f69999f82" #new webhook session
scopes = ['read_products', 'read_orders']
newSession = shopify.Session(shop_url, api_version)
auth_url = newSession.create_permission_url(scopes, redirect_uri, state)
session = shopify.Session(shop_url, api_version)
except PermissionDenied:
return HttpResponse('PermissionDenied', status=status.HTTP_204_NO_CONTENT)
return HttpResponse('OK :-)', status=status.HTTP_200_OK)
at the very least, the code works when I send a post request.
However, I am not getting a response on my return URL.
Please advise me what I might have missed.
- I have downloaded the ShopifyAPI using pip install, not added to INSTALLED_APPS in settings.py
- The return URL works when I sent requests so it should work here(I believe)
question from:
https://stackoverflow.com/questions/65897914/gettings-access-token-from-shopifyapi-python-library 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…