Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authenticate loop #6

Open
mrdbstn opened this issue May 9, 2021 · 1 comment
Open

Authenticate loop #6

mrdbstn opened this issue May 9, 2021 · 1 comment

Comments

@mrdbstn
Copy link

mrdbstn commented May 9, 2021

Hey there,

Thanks for providing us with this code it's really helpful to try and understand working with Shopify.

I am trying to add a get_products() function to shopify_client.py. It's identical to get_shop();

def get_products(self) -> dict:
        call_path = 'products.json'
        method = 'GET'
        shop_response = self.authenticated_shopify_call(call_path=call_path, method=method)

        if not shop_response:
            return 'failed request'

        return shop_response['products']

To make this work, I added the required scope 'read_products' to ACCESS_SCOPES in server.py, but now when I try to access the app, it's stuck in an infinite authentication loop, as it's not getting the access token

This actually happens every time when you restart the server, but this wasn't an issue with just the write_script_tags scope, since it would load properly if you stopped loading the page (by simply using the browser button in the top left) and then refreshing the page. This however doesn't work with more scopes added.

I don't if saving the access token in a database, instead of requesting it every time we restart the server, would do anything, as it seems it's unable to get it in the first place when requesting more scopes.

Let me know what you think of this. Thanks in advance!

@garettB
Copy link
Owner

garettB commented May 15, 2021

Hi,

If it only happens with that one scope (I would recommend trying with other scopes if you haven't) then it could be an additional requirement by Shopify possibly? Perhaps with the app setup? Sorry, I am not going to be much use for the foreseeable to help troubleshoot, but hopefully you can solve the issue or maybe someone in the Shopify forum can help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants