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

Error "Could not log in to Shopify store." #31

Open
nachoggg opened this issue Mar 30, 2020 · 8 comments
Open

Error "Could not log in to Shopify store." #31

nachoggg opened this issue Mar 30, 2020 · 8 comments

Comments

@nachoggg
Copy link

It returns this error message after installation.

  1. We loaded http://localhost:8000/
  2. App is installed in our shop
  3. it redirects to main page again with following information

"Could not log in to Shopify store"

Captura de pantalla 2020-03-30 a las 14 10 44

@hin7141
Copy link

hin7141 commented Apr 10, 2020

same here. Did you manage to fix it? @nachoggg

@tanema
Copy link
Contributor

tanema commented Apr 13, 2020

You will need to check the exception that is raised during the finalize action in shopify_app/views.py

@rx-gan
Copy link

rx-gan commented Oct 18, 2020

Problem solved. You need to install the Python SSL certificate in order to get the access token from Shopify.
Read: https://stackoverflow.com/questions/52805115/certificate-verify-failed-unable-to-get-local-issuer-certificate

Or you can try breaking the finalize function up to debug the problem yourself if it doesn't work.
Raise an exception at the right place to find the main issue. Mine was missing SSL certificate.

try:
        shop_url = params['shop']
    except Exception:
        messages.error(request, "Cannot get shop url")
        return redirect(reverse(login))

    try:
        session = _new_session(shop_url)
    except Exception:
        messages.error(request, "cannot create new session with shop url")
        return redirect(reverse(login))

    try: 
        access_token = session.request_token(request.GET.dict()) 
    except Exception:
        messages.error(request, request.GET)
        raise Exception('cannot get token')
        return redirect(reverse(login)) 

    try:
        request.session['shopify'] = {
            "shop_url": shop_url,
            "access_token": access_token
        }
    except Exception:
        messages.error(request, "cannot store session")
        return redirect(reverse(login))

@ivanadamovic
Copy link

ivanadamovic commented Jan 6, 2021

In shopfify_app/decorators.py, I found this is true when the request is
/?hmac=6949885b8cdc92ca58b6f1bc74703ccc0d249165c078f9d07ad1a2d8a8b13c93&locale=en&new_design_language=true&session=5dd637ab8a0854360df8a3b4549e1527092942e40511615d819d3cb9c23b86ab&shop=demo.myshopify.com&timestamp=1609956648

if not hasattr(request, 'session') or 'shopify' not in request.session:

That's why it redirects the login page.
But not sure what the solution is.
Anyone can help us to fix this?

Thanks.

@ivanadamovic
Copy link

@nachoggg @hin7141 Were you able to fix the issues?

@hin7141
Copy link

hin7141 commented Jan 7, 2021

Hi @ivanadamovic . I managed to fix it. The issue is you need an SSL certificate to make request.

@tanema
Copy link
Contributor

tanema commented Jan 7, 2021

The issue is you need an SSL certificate to make request.

This is more easily done with a tunnel like ngrok

@ivanadamovic
Copy link

ivanadamovic commented Jan 13, 2021

Hi @tanema, thanks for your answer.
I have tried using Ngrok but I am having the same issue.

My App URL

https://a725f8e7655c.ngrok.io/

Redirect URLs

https://a725f8e7655c.ngrok.io/shopify/finalize/
http://a725f8e7655c.ngrok.io/shopify/finalize/

Could you please help me fix this issue?
Thanks.

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

5 participants