Skip to main content

How to handle both post-purchase and direct logins in MemberStack without requiring interaction tokens?

Hey team, we have a flow where users select a subscription, create a Memberstack account, complete payment via Stripe, and then get redirected to login.merchmate.com to log in.

The issue is that login.merchmate.com only works when there's an interaction token in the URL (e.g. login.merchmate.com/interaction/{token}). Without a token, the page returns a 404.

This creates a problem for returning members who just want to log in directly — for example, clicking a login button on our marketing site and being sent to login.merchmate.com to sign in with their existing credentials. There's no active session or purchase flow to generate a token in that case.

Is there a way to have login.merchmate.com serve as a general-purpose login page that works with or without a token? Essentially, we want it to handle both scenarios:

  1. Post-purchase redirects (with token)
  2. Direct logins for returning members (no token)

We see other apps handle login this way and want to make sure we're not missing something in our setup. Any guidance would be appreciated!

5 comments

  • Duncan from Memberstack
    Duncan from Memberstack

    Can you say more about this part here?

    The issue is that login.merchmate.com only works when there's an interaction token in the URL (e.g. login.merchmate.com/interaction/{token}). Without a token, the page returns a 404.

    A token is not normally required if you're using, say Memberstack on a standard Webflow site. The token is present after checkout to carry over the information from the stripe checkout session, but its not required to login.

    What is the purpose of the subdomain?

    And login does seem to be working for me when navigating from merchmate.com. I'm still not sure what the interaction token is or why it's needed, but I expect you have a good reason! Maybe for tracking?

    https://login.merchmate.com/interaction/7zyiDYuxMgBq5If-rLdmAU5Wdy0syt3f-gnTrYjt3Bk

    0
  • Markese Straughter
    Markese Straughter OP

    Duncan Hamra A few notes to clarify our setup:

    The marketing site is on Webflow but the actual app is a custom build. Memberstack is installed on the custom app, not on the Webflow marketing site. The login element currently lives at login.merchmate.com which is how our developer set it up initially. Our plan is to move that to app.merchmate.com/login as the proper path going forward.

    login.merchmate.com was set up as a bridge between the Stripe checkout flow and the custom app. The reason the interaction token is needed is because after a member completes their Stripe purchase, we need a way to carry that session and purchase context over to the app so the right plan and account gets activated on login. That's what the token is doing,  it's connecting the checkout event to the member's account in the app, not just tracking.

    The issue we're running into is that login.merchmate.com returns a 404 or Bad Request when users land there without a valid interaction token, which affects returning members trying to log in directly rather than coming through a checkout flow.

    Hopefully that gives you a full picture of where we're at. If there's a cleaner solution you'd recommend for the login flow, we're open to it. We do wonder if having the login element on the Webflow side is a viable option, though we have concerns about how that would connect authenticated users on Webflow to their accounts inside the custom app. Would love your thoughts on the best path forward before we start making changes.

    0
  • A J
    A J

    Hey Markese Straughter,

    If you don't mind having Memberstack installed in Webflow for letting users sign up / login there, then you can explore Cross Domain login feature which will ensure the member is logged in both the marketing site and the app provided that both share the same root domain (in your case I am assuming it's merchmate.com).

    Kindly go through the guide linked above and let us know if it helps / makes sense for your project.

    0
  • Duncan from Memberstack
    Duncan from Memberstack

    Question - Would it cause issues in your custom site if you anticipated people going to login.merchmate.com without a token? And display the login even without the token? That's how most custom Memberstack project handle it now I believe.

    0
  • Markese Straughter
    Markese Straughter OP

    A J Duncan Hamra Spent some time yesterday reviewing everything and I believe we got this thing figured out. We gotta make some adjustments on our end but we're gonna test it out today. I'll let you guys know if we have any issues. Appreciate you both.

    0

Please sign in to leave a comment.