OneList is a modern, open-source web application built with Next.js that allows you to browse and display files from a Microsoft OneDrive account. It features a clean, responsive interface, secure authentication, and shareable, persistent links to files and folders.
This project was bootstrapped using create-next-app
.
/files/...
) that can be shared directly.Follow these instructions to get a copy of the project up and running on your local machine.
git clone https://github.com/your-username/onedrivelist.git
cd onedrivelist
npm install
To get apps to access OneDrive, you need to register an app in the Microsoft Entra Admin Center:
http://localhost:3000/api/auth/callback/microsoft-entra-id
https://<your-vercel-domain>/api/auth/callback/microsoft-entra-id
http://localhost:3000/api/auth/callback/microsoft-entra-id
(can be deleted after completion).User.Read
, Files.ReadWrite.All
, offline_access
, and then click Grant admin consent.AUTH_MICROSOFT_ENTRA_ID_ISSUER
according to the tenant type:
https://login.microsoftonline.com/common/v2.0
https://login.microsoftonline.com/<your-tenant-id>/v2.0
https://login.microsoftonline.com/organizations/v2.0
https://login.microsoftonline.com/consumers/v2.0
After completing the above steps, you can continue to configure environment variables and obtain OneDrive Refresh Token.
Create a .env.local
file in the root of your project by copying the example file:
cp .env.example .env.local
Open .env.local
and fill in the following values:
AUTH_URL
: Base URL of your application—used for callbacks and redirectsAUTH_SECRET
: A secret string used to sign tokens. Generate one using openssl rand -base64 32
in your terminal.AUTH_MICROSOFT_ENTRA_ID_ID
: Your Application (client) ID from the Entra App Registration.AUTH_MICROSOFT_ENTRA_ID_SECRET
: Your client secret value from the Entra App Registration.AUTH_MICROSOFT_ENTRA_ID_ISSUER
: The issuer URL from the Entra App Registration (e.g., https://login.microsoftonline.com/common/v2.0
).ONEDRIVE_REFRESH_TOKEN
: Leave this blank for now. You will obtain it in the next step.The first time you run the application it will enter setup mode automatically. Follow these steps to obtain your permanent refresh token:
Start the development server:
npm run dev
After the server starts:
http://localhost:3000
in your browserhttps://<your-vercel-domain>
You will see a setup page with a "Login with Microsoft" button.
Click the button and complete the login. After authentication you will be redirected to /token
, where your refresh token is displayed on screen.
Copy this token. Go to your Vercel project dashboard, navigate to Settings > Environment Variables, and add it as ONEDRIVE_REFRESH_TOKEN
.
Restart the development server. The app will now start in normal mode and display your OneDrive files.
With ONEDRIVE_REFRESH_TOKEN
set, run:
Now that the refresh token is set, you can run the application publicly.
npm run dev
Open http://localhost:3000 with your browser to see your OneDrive files.
This application is optimized for deployment on Vercel.
.env.local
file:AUTH_URL
AUTH_SECRET
AUTH_MICROSOFT_ENTRA_ID_ID
AUTH_MICROSOFT_ENTRA_ID_SECRET
AUTH_MICROSOFT_ENTRA_ID_ISSUER
ONEDRIVE_REFRESH_TOKEN
This project is licensed under the MIT License - see the LICENSE
file for details.