currently i have 2 folders in Webflow one containi...
# ask-a-descoper
r
currently i have 2 folders in Webflow one containing 8 pages and another containing 4 pages...so i want that the folder with 8 pages does sso whereas the other folder pages open without sso...can this be integrated by descope?
c
Hey Rishti, Are you saying you want some pages to be authenticated before viewing, while others can be viewed without auth?
r
Yes
c
So the default behavior in the Descope Webflow guide redirects ALL pages to login. The redirect code is placed in the site-wide Footer Code, which runs on every page. So you'll need to kind of adjust into a path based approach. Instead of protecting all pages globally, you can modify the footer script to only redirect to login if the current path is one of the protected pages:
Copy code
<script>
  const sdk = Descope({ projectId: "__ProjectID__", persistTokens: true });

  const sessionToken = sdk.getSessionToken();
  const currentPath = window.location.pathname;

  // List the paths of the 8 pages that require SSO/auth
  const protectedPaths = [
    '/protected-page-1',
    '/protected-page-2',
    // ...add all 8 paths here
  ];

  const isProtected = protectedPaths.some(path => currentPath.startsWith(path));

  if (isProtected) {
    if (!sessionToken || sdk.isJwtExpired(sessionToken)) {
      if (currentPath !== '/login') {
        window.location.replace('/login');
      }
    }
  }
</script>
This goes in Site Settings → Custom Code → Footer Code, replacing the default snippet from the docs. Summary of steps: 1. Add the Descope web-js-sdk to the site-wide Head Code in Webflow Settings → Custom Code. descope 2. Create a
/login
page with the Descope web component embedded via an HTML Embed element. descope 3. In the Footer Code, use the path-based script above instead of the default global redirect — listing only the 8 protected page paths. 4. The 4 pages in the other folder are simply not in the
protectedPaths
array, so they load freely without auth. This approach requires no changes per-page — it's all managed from one central script. If Webflow folders have consistent URL prefixes (e.g.,
/members/...
vs
/public/...
), the check can be simplified to a single
startsWith('/members')
instead of listing each path individually. @Mrunank Pawar should we update the doc?
👀 1
r
can you tell me how can i do admin dashboard sso in webflow?