You can protect a folder with a password.
Specify Protected Folders
Define the paths of the folders you wish to protect in the NEXT_PUBLIC_PROTECTED_ROUTES
environment variable, separated by |
. Use the full path and no "
is needed.
Example: /Private|/Demo123|/A Folder with spaces
.
Note: Exclude the BASE_DIRECTORY
part from the path. For instance, if BASE_DIRECTORY=/MyBase
and you want to protect /MyBase/Private
, simply use /Private
in NEXT_PUBLIC_PROTECTED_ROUTES
.
The NEXT_PUBLIC_
prefix indicates that the value will be accessible on the client side (not restricted to the server side). This is a built-in feature of Next.js and does not imply "public routes".
Create a Protection File
Inside each folder you want to protect, create a plain text file named either .password
. Add the desired password inside this file.
OnePortal cannot provide any security guarantee. There is no rate limit here, so theoretically, passwords can be brute-forced.
Also, here are the caveats:
&odpt=...
. If you share direct links with others, they can download the files without authentication.If you want to share files with others but don't want extra people to see them, it is recommended to use OneDrive's built-in sharing function.