Webflow Hacks

Auto-Login on Password-Protected Page

Overview
Webflow Element Hacks
Hidden Default Tab
101
Mobile Touch to Click Event
102
Webflow Utility Hacks
Auto-Login on Password-Protected Page
120
Webflow Editor Hacks
Enhancing Webflow's Content Editor
901
Shopify
Shopify Buy Button
901
Webflow Designer Hacks
Download All Designer Assets
30:00
921
Replace a Webflow Asset
30:00
922
Component Hacks
Style Component Instances
941
No items found.
Published
July 12, 2023
in lightbox

In certain cases it's useful to have a login-protected page, but to be able to circumvent that with a special link that you can share to special users;

  • A unique special offer
  • A customer-only pricing page
  • Internal products specs, a CV or a special download

Webflow doesn't support this natively however the standard password-protection feature can be easily augmented using a bit of JS.

In this way, if I have set a page to anyone with the password and assigned a password of secret, I can then share a direct link to that page as;

https://www.mysite.com/myprotectedpage?pass=secret

Users who click that link will briefly see the login page, and will be automatically logged in before being directed to the protected page.

Implementation

Add this to the Password utility page, in the /body custom code section.

Do not add it to the page that you are password-protecting, it must go on the utility page itself, which is next to the 404 page in Webflow's page navigator.

Publish your site, and test it out by using a URL to your protected page.

Note, the password protection feature only works on hosted sites, which means you must have a hosting plan in place for this to work.

Notes

  • If you have several password protected pages and folders throughout your site, you should only need to implement this once, and it should work for all of them, even if they have different passwords. Make certain to use the right password in the URL.
  • People who do not have the ?pass=your-password part of the URL will be directed to the login page and will need to manually login.
Table of Contents
Comments
Did we just make your life better?
Passion drives our long hours and late nights supporting the Webflow community. Click the button to show your love.