`session-token` auth finalization view doesn't log users in
See original GitHub issueHello! I’m updating an app that uses this package to use session token auth instead of cookies, and after investigating a redirect loop, I think I’ve discovered that the “finalize” view used for session token auth doesn’t log a user in the way the cookie-based auth views do.
shopify_auth.views.finalize()
has the lines:
user = auth.authenticate(request=request, myshopify_domain=shopify_session.url, token=shopify_session.token)
if user:
auth.login(request, user)
but shopify_auth.session_tokens.views.FinalizeAuthView.get()
doesn’t have this code. Adding those lines into the view seems to log in the user and make the app behave as intended.
Is this a valid issue and a potential fix or am I using the auth views in an unintended manner? Thanks in advance so much for the help.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
Check for user session status in browser cookies and ... - Ory
To check if the user is signed in and has an active session, use the /sessions/whoami endpoint. If the user doesn't have an...
Read more >Actions Triggers: post-login - API Object - Auth0
The API object for the post-login Actions trigger includes: api.access. Modify the user's login access, such as rejecting the login attempt.
Read more >Authentication API - Okta Developer
The Okta Authentication API provides operations to authenticate users, ... Check out the Okta Sign-In Widget which is built on the Authentication API....
Read more >Session Management - OWASP Cheat Sheet Series
The session ID or token binds the user authentication credentials (in the form of a user session) to the user HTTP traffic and...
Read more >Configure authentication session management - Microsoft Entra
Customize Azure AD authentication session configuration including user sign-in frequency and browser session persistence.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Been a while since following up on this, but I wanted to thank you again for the advice–did a lot more research and reworking, and ended up implementing Turbolinks as suggested. Your feedback and responses helped me gain a much better and deeper understanding of the underlying data flow and the demo app was an invaluable reference!
That’s most likely the problem. I recommend you to read https://shopify.dev/apps/auth/oauth/session-tokens. They do much better job explaining than I could do 😃 But in short you need to use authentication header instead of cookies to authenticate and that can only be done with some amount of javascript involved. With Turbolinks being the least invasive approach.
I also updated the demo app to work with the latest version of
django-shopify-auth
, cleaned it up a bit and added billing.