Data Retrieval not happening while trying by using Partners account

Topic summary

A developer is attempting to retrieve merchant data using a Shopify Partners account via Python but is not receiving an authorization code.

Technical Details:

  • Using the shopify Python library with API credentials
  • Implementing OAuth flow with redirect URI
  • Requesting scopes including read_products and read_orders
  • API version: 2023-04

Issue:
The authorization code is not being generated during the OAuth authentication process. The code appears to set up the session, create a permission URL, and wait for user authentication, but the authorization callback is failing.

Current Status:
The discussion remains open with no responses or solutions provided yet. The developer is seeking guidance on proper implementation or troubleshooting steps for retrieving merchant data through a Partners account.

Summarized with AI on November 21. AI used: claude-sonnet-4-5-20250929.

Hello I am trying to retrieve the data from the marchant account by using the partners account with the below python code. I am not getting any Authorization code. Please resolve this or suggest how to do that.

import shopify
import binascii
import os

Set up the Shopify API session

API_KEY = ‘22434e0c8d10dcd3f72f187c1d7149e5’
API_SECRET = ‘b725127b7309553d0489f40a35d27138’
APP_NAME = ‘Online Store’
SHOP_NAME = ‘58402c.myshopify.com
API_VERSION = ‘2023-04’
REDIRECT_URI = ‘https://58402c.myshopify.com/oauth/callback

Set up the session with your API Key and Secret Key

shopify.Session.setup(api_key=API_KEY, secret=API_SECRET)

Set up the authentication URL

session = shopify.Session(SHOP_NAME, API_VERSION)
pos = binascii.b2a_hex(os.urandom(15)).decode(“utf-8”)
scopes = [‘read_products’, ‘read_orders’]
auth_url = session.create_permission_url(scopes, REDIRECT_URI, pos)
if ‘state’ in auth_url:
auth_url=auth_url.replace(‘state’,‘fstate’)

Redirect the user to the authentication URL and prompt them to accept the permissions

print(f"Please go to this URL to authenticate with Shopify:\n{auth_url}\n")

Wait for the user to authenticate and then enter the code parameter provided in the redirected URL

code = input("Please enter the code parameter from the redirected URL: ")

Request an access token using the code parameter

session.request_token({‘code’: code})

Activate the session and access the products table

shopify.ShopifyResource.activate_session(session)
products = shopify.Product.find()

Print out the list of products

for product in products:
print(product.title)

Clear the session

shopify.ShopifyResource.clear_session()