Skip to content
HM-MODS edited this page Jul 25, 2024 · 1 revision

Create a Redis Connection

Create a Redis database, and set the URL of the Redis instance to environment variable REDIS_URL inside the Vercel project. The Redis database is used for storing the required access_tokens and refresh_tokens when interfacing with OneDrive's API.

You can use Aiven.io for this, completely free. You can also host any Redis server, use AWS, Google Cloud, Azure, etc. As long as you have a Redis URL that Vercel can use. Whatever method you use, you should have a REDIS_URL present in your environment variable in Vercel which should look like: redis://:xxx...@some-thing-like-27934.e.aivencloud.com:27934 OR rediss://:xxx...@some-thing-like-27934.e.aivencloud.com:27934

Aiven Redis (ValKey)

Open Aiven.io and select get started for FREE image After that sign-up using Google or Email. image Then select "Personal" as shown in the above image. Fill in the required details. image Then select "ValKey" from the drop down menu. Fill in the required details, and create the FREE service image Then copy the redis connection URL.

Add REDIS to Vercel

Inside the Vercel app settings, select "Environment Variables" and add a new Variable "REDIS_URL" whose value would the REDIS CONNECTION URL that u copied from Aiven.io

Redeploy on Vercel

Finally, trigger a redeployment on Vercel to use the new environment variable, navigate to the newly deployed page, and perform authorisation as guided by Chiheisen-vercel-index. The domains used by Vercel are listed in your project settings. You can also configure a custom domain here. (More on this in Custom domain.) image

Authenticate you Chiheisen-vercel-index

Navigate to your newly deployed chiheisen-vercel-index, usually https://xxx.vercel.app/ if you have not set a custom domain. As you are not authenticated yet, you will be redirected to the OAuth process. If you are somehow not redirected to the authorization process, visit this site - https://xxx.vercel.app/onedrive-vercel-index-oauth/step-1/ Replace xxx with your vercel custom domain.

Step-1 Preparations Screenshot 2023-08-15 160135

Step-2 Get auth code Screenshot 2023-08-15 140589 Click on the link, a new tab will open and prompt you to login into your Microsoft account. Make sure you login with the same account you defined in userPrincipalName under config/site.config.js. image You will be directed to http://localhost, copy the entire URL in your address bar to the input section below. Chiheisen-vercel-index will extract the code from the URL and use that to acquire a pair of access_token and refresh_token. Click on Get tokens to proceed.

Step-3 Get access and refresh tokens Screenshot 2023-07-15 150985 Wait for a bit as the tokens need a bit to return. If all goes well, you would be greeted with this: success screen with a pair of valid tokens for you to store in your Redis database. Click on Store tokens to proceed.

Finally, you will be redirected home with your new and fresh Chiheisen-vercel-index. Enjoy!

Clone this wiki locally