Why is my session variable not working in my Python-built Shopify app?

sgtlab
Shopify Partner
5 1 1

I'm building Shopify App using Python(Flask framework). On post-installation, I create a session variable as below and then redirect to my app main page

 

session['current_profile_id'] = my_profile_id_value

 

 From my app, I try to read the value but always got None which means the session variable was somehow not set.

 

session.get('current_profile_id')

 

Can I use sessions to share data across my app? 

SGT-Lab
- Press like to let us know if my reply was helpful - Thank you!
- Come visit us at SGT-LAB
- Support us with COFFEE TIP
Replies 2 (2)

Zworthkey
Shopify Partner
5581 642 1567

Hii @sgtlab,
I hope this link is helpful for you. 

Thank You.

sgtlab
Shopify Partner
5 1 1

My app is an embedded app so it is loaded inside an iframe from Shopify admin. It seems that the session cannot be used in Iframe.

There is a report here someone facing the same issue: https://stackoverflow.com/questions/60605801/flask-session-is-not-persisting

SGT-Lab
- Press like to let us know if my reply was helpful - Thank you!
- Come visit us at SGT-LAB
- Support us with COFFEE TIP