Use Descope With Squarespace
Using Squarespace to design and build your web applications doesn't mean you can't enjoy advanced authentication and authorization. This guide will show you how to integrate Descope into your Squarespace website seamlessly.
Getting Started with Squarespace Settings
-
Access your Squarespace dashboard, and select the site you wish to edit, then navigate to Settings.
-
In Settings, click on Advanced, then select Code Injection:
-
Add the Descope SDK script into the Header section to enable Descope features across your website:
Creating a Login/Sign-Up Page
-
Go to your site's main menu and choose Pages, then click + Add Page and name it Login.
-
On the newly created Login page, add a Code Block from the Build section:
-
Insert this HTML and script into the Code Block:
Update x.x.x
to the latest version of the Web Component, available here
This code embeds the Descope web component, enabling user authentication and redirection upon successful login.
Handling Redirects for Unauthorized Access
To ensure users are redirected to log in if they are not authenticated:
- In the same Code Injection section, add the following script to the Footer:
You will have to apply this to either your entire site, or copy this code to specific page footers to protect only specific pages.
Fetching User Details for Your Frontend
To display user-specific details:
Final Thoughts
By integrating Descope into your Squarespace site, you've equipped your website with robust authentication capabilities. For further customization or if you need logout functionality and backend session validation, refer to our detailed documentation:
- Logout Using Client SDK - here
- Backend Session Validation - here
- Roles and Permissions - This can be found in Step 7 of the guide here
If you encounter any challenges or have questions, our support team at Descope is ready to assist you.