Inject code to Squarespace site to know when a user is logged in on bubble

Hello!
As my the subjects says: anyone know how to setup a function like this:

  • I have a squarespace site where the landing page of the app lives
  • I have a bubble app on another custom domain
  • I would love to let the squarespace site KNOW when a user in the bubble app is logged in
  • After that, I need to tell squarespace to redirect the visitor of the landing page to the bubble app domain

Seems simple to do maybe with workflows exposed via api, but honestly I don’t know where to start thinking this.

@vini_brito any ideas mate? :slight_smile:

Thanks in advance for the help guys :smiley:

Oh hi Andrea! :blush:
Can you tag the user somehow in Squarespace? If so, is there any detection mechanism, for example “user logs in and is tagged with Bubble User” for you to run the redirection code there?
Or Squarespace is a static page builder and offers no workflow stuff and we’d need to custom code a script and inject our script there?

1 Like

Hello! :upside_down_face:

Definitely this. Squarespace on pro plans offers to inject custom CSS and custom code, javascripts etc. So I think we should think a solution based on this approach (and I’m a total ignorant in that matter ahah)

Yeah then I think that the way to go with the custom script is this one:

  • The user logs into squarespace
  • The script captures the successfuly logged in email
  • Sends that email address to Bubble’s exposed API endpoint
  • The backend workflow searches if the email exists
  • If so, send back a message “yeah it exists here, react accordingly”
  • Script reacts accordingly by redirecting the user to Bubble.

Consideration on privacy: This would allow someone to probe the exposed API endpoint for existing addresses and see who has an account and who doesn’t, however I don’t think this worsen things because Bubble itself already does this in the login form by saying “user doesn’t exists” and “email exists but wrong password”.

Unless Bubble team has fixed this privacy issue, then of course it will decrease privacy, but I saw no updates on this so nothing will change. Just saying this so you’re aware of it for future consideration if Bubble team ever fixes this privacy issue in their login form.

Aaah awesome!

Then I think this may be simpler.
Let me explain in detail the actual situation:

  1. User already logged in into bubble app in the past app.maindomain.io, so if the said used goes directly into the bubble app he will be logged in;
  2. This user, maybe later in time, wants to navigate into bubble app again, but instead -erroneusly- navigates into the squarespace’s landing page maindomain.io of the app
  3. So, the user will have to click a simple “login” button on the landing page that simply redirects the user into app.maindomain.io where’s he’s already logged in and starts using the app

To eliminate point 2 from the list, ideally the path should be:

  1. Same as point 1
  2. When user erroneusly navigates into landing page maindomain.io squarespace should in someway ask “app.maindomain.io” if this user is logged in and then automatically redirect the user in “app.maindomain.io” without clicking any “LOGIN” button or whatever.

I know this may sound ridicoulous, but the level of support tickets opened because of this is ridicoulous, and at the moment for marketing and control reasons I need to maintain squarespace platform.

Got it. Well, I think then the script can check for cookies, since it’s the same domain and cut out all the backend workflow stuff. I (or someone else) would just need to sit on it and confirm this, but there’s a good chance it would work just fine.

1 Like

Awesome!
Thanks sooo much @vini_brito :smiley:
Back to pvt then :blush:

1 Like

Hi,

I find myself in a situation similar to one you’ve encountered previously, and I would greatly appreciate it if you could share your insights and experience with me.

My issue: My Website is maindomain.io, and I’ve set up a client portal using Bubble at app.maindomain.io. I believe it’s crucial that once a user is logged into app.maindomain.io, they should remain on that page. Should they navigate to maindomain.io, I want them to be automatically redirected back to app.maindomain.io until they log out.

I’m eager to learn about your approach to managing this scenario and any strategies you employed to ensure a seamless user experience.

Thank you very much for your time and help in advance.