Index

Index

Soaib Khan

1. Go to https://github.com/Soaibkhan38/onedrive-cf-index and download the repo as a zip

2. Copy the content of the zip to a new folder.

Select all the contents
Copy it to New folder

3. Make a Workers account: https://workers.cloudflare.com/ and set-up a sub-domain. Choose the free plan and done.

4. Now we have to get Azure API to get a token and make the index. Go to this page https://heymind.github.io/tools/microsoft-graph-api-auth and perform step 1, 2, 3, 4:

5. For step 1 of Prerequisite, go to https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade . Click on New Registrations, and fill the form like this

6. Note the Application (client) ID, we will need it later

7. Go to Certificates & secrets, click on New client secret


8. Copy the Value and it keep it for later


9. Go to API permissions, click on Add a permission, Microsoft Graph, Delegated Permissions, select offline_accessFiles.ReadFiles.Read.All

10. In https://heymind.github.io/tools/microsoft-graph-api-auth, fill client id from step 8, click on Authorize. You will be redirected to Azure page. Accept it

11. Copy the whole code

12. Download Insomnia Designer for windows, Go to the DEBUG tab, right-click, New request, make a POST request to https://login.microsoftonline.com/common/oauth2/v2.0/token

13. Make the form like this. Take the code from step 11, client_id from step 6, client_secret from step 8, scope offline_access%20Files.Read%20Files.Read.All, redirect_uri https://heymind.github.io/tools/microsoft-graph-api-auth, grant_type authorization_code. Add https://login.microsoftonline.com/common/oauth2/v2.0/token on the right-side of POST. After filling the form, hit Send

14. You will get a 200 OK and your Access token and Refresh token, which will be used later, so don't close Insomnia Designer


15. From Step 2, go to the New Folder, Go to https://developers.cloudflare.com/workers/cli-wrangler/install-update and follow the instructions to download wrangler17. (I used PowerShell, but you can use Command prompt as well)

16. Run the command "wrangler login" from powershell, let it open a browser window, authorize wrangler (if this method doesn't work, copy your Global API key from browser, press CTRL+C and run the command "wrangler config --api-key", enter you email and Global API key and done)

17. Rename the "New Folder" to whatever name you want your website to start with. For example, teamdrive. So your website will be named like, teamdrive.soap1.workers.dev

18. Go back to Cloudfare Workers, copy the Account ID (we will need later), click on Create a worker. Change the name here to your folder name


19. Go back to your folder, open wrangler.toml file on notepad or any text editor, replace the account_id with yours, leave zone_id blank and delete kv_namespace entry completely and save it

20. Go back to Powershell and run "wrangler kv:namespace create "BUCKET" --preview", copy the configuration it gives and paste it back in wrangler.toml. Also, replace name with your site name


21. Make a "Public" folder in your onedrive. Here you will store your data.


22. Go to src/config and edit default.js. Replace refresh_token, client_id, client_secret from what you entered in Insomnia designer

23. After all of this, go back to Powershell and run "wrangler preview", to see a preview of your website

24. Run "wrangler publish" to Publish your website. And remaining doubts, ask Zero



Report Page