Skip to content

Latest commit

 

History

History
64 lines (40 loc) · 2.45 KB

File metadata and controls

64 lines (40 loc) · 2.45 KB

iTwin Viewer App Template

This template is built using vite. New app based on this template can be created by running:

npx degit saskliutas/vite-itwin-web-viewer#main my-project

Environment Variables

Prior to running the app, you will need to add OIDC client configuration to the variables in the .env file:

# ---- Authorization Client Settings ----
IMJS_AUTH_CLIENT_CLIENT_ID=""
IMJS_AUTH_CLIENT_REDIRECT_URI=""
IMJS_AUTH_CLIENT_LOGOUT_URI=""
IMJS_AUTH_CLIENT_SCOPES=""
  • You can generate a test client to get started.

  • Viewer expects the itwin-platform scope to be set.

  • The application will use the path of the redirect URI to handle the redirection, it must simply match what is defined in your client.

  • When you are ready to build a production application, register here.

You should also add a valid iTwinId and iModelId for your user in the this file:

# ---- Test ids ----
IMJS_ITWIN_ID = ""
IMJS_IMODEL_ID = ""
  • For the IMJS_ITWIN_ID variable, you can use the id of one of your existing iTwins. You can obtain their ids via the iTwin REST APIs.

  • For the IMJS_IMODEL_ID variable, use the id of an iModel that belongs to the iTwin that you specified in the IMJS_ITWIN_ID variable. You can obtain iModel ids via the iModel REST APIs.

  • Alternatively, you can generate a test iModel to get started without an existing iModel.

  • If at any time you wish to change the iModel that you are viewing, you can change the values of the iTwinId or iModelId query parameters in the url (i.e. localhost:3000?iTwinId=myNewITwinId&iModelId=myNewIModelId)

Running App

Run the following:

pnpm install
pnpm dev

Open http://localhost:3000 to view it in the browser.

Next Steps