Password protected folders
You can now protect a folder or directory with passwords.
- Declare the protected folder's path under
protectedRoutes(which is an array) in
- Create a plain text file that is named
.password(character for character, must be this name), and move this file under the folder that you wish to password protect.
- Open this
.passwordfile with a text editor, like VS Code or Notepad, and save the password inside (in plain text format).
- Finally, redeploy your onedrive-vercel-index in Vercel so your website picks up the newest protected folder configs.
If you are wondering what to define in
protectedRoutes, here is an example.
Suppose we have the following folder structure:
. ├── 📕 Books │ └── ... ├── 🌞 Private folder │ ├── this-is-public │ └── u-need-a-password <-- this is the folder to protect ├── 🍡 Genshin PV │ └── ... └── README.md
We want to password protect the
/u-need-a-password directory, so we would write inside
protectedRoutes the absolute path to root.
"protectedRoutes": [ "/🌞 Private folder/u-need-a-password", ],
If you want to add another route, then add it to the next item in the array.
"protectedRoutes": [ "/🌞 Private folder/u-need-a-password", "/another/route/for/me/to/protect", ],
If there is no directory for you to password protect and you want to disable this function, you can simply pass an empty array
If you are confused about whether you need to encrypt your password, don't. Put that plain text inside
.password. Whatever you save inside
.password, you are going to use as the password for entering the protected directory.
Yes, all seemingly secure protections come at a cost.
The direct link of the files under your protected directory can be shared with the URL parameter
&odpt=<hashed_token>, if you really want to:
Whether or not this exposes your password, protected files, personal information, etc., is all unknown. Use at your own risk.
I personally cannot guarantee that this protection is impenetrable and fully secure. Hence, I would not recommend protecting sensitive information with this method. Think of this as an extra layer of annoyance to keep files you want to share with only the people you wish.
More on this in Password protected routes is now supported #66.