# OpenLayers + Vite

This example demonstrates how the `ol` package can be used with [Vite](https://vitejs.dev/).

To get started, run the following (requires Node 14+):

    npx create-ol-app my-app --template vite

Then change into your new `my-app` directory and start a development server (available at http://localhost:5173):

    cd my-app
    npm start

To generate a build ready for production:

    npm run build

Then deploy the contents of the `dist` directory to your server.  You can also run `npm run serve` to serve the results of the `dist` directory for preview.

NOTE: Client Secret needs to be refreshed every 24 months (04/08/2025)
In order to generate a delegate token, follow these instructions:
https://learn.microsoft.com/en-us/graph/use-postman-with-delegated-authentication
The permissions needed are (placed in the Scope section of the setting up Delegated Token Folder):

offline_access Files.Read.All Sites.ReadWrite.All

Once the request is sent grab the refresh_token generated and use it to get a Sharepoint Access Token.

Get Sharepoint Access Token: 

client_id=d8a81fac-1ec0-4899-a266-559a91c16ae8
client_secret=<APP SECRET>  
refresh_token=<REFRESH TOKEN FROM ABOVE>  
grant_type=refresh_token  
scope=https://crownconsulting.sharepoint.com/.default  