diff --git a/common/changes/@itwin/cra-template-desktop-viewer/mindaugas-update-default-template-scopes_2024-10-31-11-22.json b/common/changes/@itwin/cra-template-desktop-viewer/mindaugas-update-default-template-scopes_2024-10-31-11-22.json new file mode 100644 index 00000000..296e3815 --- /dev/null +++ b/common/changes/@itwin/cra-template-desktop-viewer/mindaugas-update-default-template-scopes_2024-10-31-11-22.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/cra-template-desktop-viewer", + "comment": "Updated .env file in CRA template to have the `itwin-platform` scope.", + "type": "patch" + } + ], + "packageName": "@itwin/cra-template-desktop-viewer" +} \ No newline at end of file diff --git a/common/changes/@itwin/cra-template-web-viewer/mindaugas-update-default-template-scopes_2024-10-31-11-22.json b/common/changes/@itwin/cra-template-web-viewer/mindaugas-update-default-template-scopes_2024-10-31-11-22.json new file mode 100644 index 00000000..4e17bfba --- /dev/null +++ b/common/changes/@itwin/cra-template-web-viewer/mindaugas-update-default-template-scopes_2024-10-31-11-22.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/cra-template-web-viewer", + "comment": "Updated .env file in CRA template to have the `itwin-platform` scope.", + "type": "patch" + } + ], + "packageName": "@itwin/cra-template-web-viewer" +} \ No newline at end of file diff --git a/common/config/rush/pnpm-config.json b/common/config/rush/pnpm-config.json index ea91c664..ca22b40a 100644 --- a/common/config/rush/pnpm-config.json +++ b/common/config/rush/pnpm-config.json @@ -6,6 +6,8 @@ "braces": "^3.0.3", "path-to-regexp@>=0.2.0": "^8.0.0", "path-to-regexp@<0.1.10": "^0.1.10", - "postcss": "^8.4.31" + "postcss": "^8.4.31", + "http-proxy-middleware": "^2.0.7", + "rollup": "^2.79.2" } } \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 651cf03d..061f3b29 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3,9 +3,11 @@ lockfileVersion: 5.4 overrides: body-parser@<1.20.3: ^1.20.3 braces: ^3.0.3 - postcss: ^8.4.31 path-to-regexp@>=0.2.0: ^8.0.0 path-to-regexp@<0.1.10: ^0.1.10 + postcss: ^8.4.31 + http-proxy-middleware: ^2.0.7 + rollup: ^2.79.2 importers: @@ -4647,7 +4649,7 @@ packages: engines: {node: '>=14.0.0'} dev: false - /@rollup/plugin-babel/5.3.1_je4nbmfg47mhbnn75kmajdcj7i: + /@rollup/plugin-babel/5.3.1_w6kn3gmbfhpa2ap3fyykp2cmt4: resolution: {integrity: sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==} engines: {node: '>= 10.0.0'} peerDependencies: @@ -4660,38 +4662,38 @@ packages: dependencies: '@babel/core': 7.24.7 '@babel/helper-module-imports': 7.24.7 - '@rollup/pluginutils': 3.1.0_rollup@2.79.1 - rollup: 2.79.1 + '@rollup/pluginutils': 3.1.0_rollup@2.79.2 + rollup: 2.79.2 transitivePeerDependencies: - supports-color dev: true - /@rollup/plugin-node-resolve/11.2.1_rollup@2.79.1: + /@rollup/plugin-node-resolve/11.2.1_rollup@2.79.2: resolution: {integrity: sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg==} engines: {node: '>= 10.0.0'} peerDependencies: rollup: ^1.20.0||^2.0.0 dependencies: - '@rollup/pluginutils': 3.1.0_rollup@2.79.1 + '@rollup/pluginutils': 3.1.0_rollup@2.79.2 '@types/resolve': 1.17.1 builtin-modules: 3.3.0 deepmerge: 4.3.1 is-module: 1.0.0 resolve: 1.22.8 - rollup: 2.79.1 + rollup: 2.79.2 dev: true - /@rollup/plugin-replace/2.4.2_rollup@2.79.1: + /@rollup/plugin-replace/2.4.2_rollup@2.79.2: resolution: {integrity: sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg==} peerDependencies: rollup: ^1.20.0 || ^2.0.0 dependencies: - '@rollup/pluginutils': 3.1.0_rollup@2.79.1 + '@rollup/pluginutils': 3.1.0_rollup@2.79.2 magic-string: 0.25.9 - rollup: 2.79.1 + rollup: 2.79.2 dev: true - /@rollup/pluginutils/3.1.0_rollup@2.79.1: + /@rollup/pluginutils/3.1.0_rollup@2.79.2: resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==} engines: {node: '>= 8.0.0'} peerDependencies: @@ -4700,7 +4702,7 @@ packages: '@types/estree': 0.0.39 estree-walker: 1.0.1 picomatch: 2.3.1 - rollup: 2.79.1 + rollup: 2.79.2 dev: true /@rushstack/eslint-patch/1.10.3: @@ -10516,8 +10518,8 @@ packages: transitivePeerDependencies: - supports-color - /http-proxy-middleware/2.0.6_@types+express@4.17.21: - resolution: {integrity: sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==} + /http-proxy-middleware/2.0.7_@types+express@4.17.21: + resolution: {integrity: sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==} engines: {node: '>=12.0.0'} peerDependencies: '@types/express': ^4.17.13 @@ -15586,7 +15588,7 @@ packages: rollup-plugin-inject: 3.0.2 dev: true - /rollup-plugin-terser/7.0.2_rollup@2.79.1: + /rollup-plugin-terser/7.0.2_rollup@2.79.2: resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser peerDependencies: @@ -15594,7 +15596,7 @@ packages: dependencies: '@babel/code-frame': 7.24.7 jest-worker: 26.6.2 - rollup: 2.79.1 + rollup: 2.79.2 serialize-javascript: 4.0.0 terser: 5.31.1 dev: true @@ -15605,8 +15607,8 @@ packages: estree-walker: 0.6.1 dev: true - /rollup/2.79.1: - resolution: {integrity: sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==} + /rollup/2.79.2: + resolution: {integrity: sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==} engines: {node: '>=10.0.0'} hasBin: true optionalDependencies: @@ -17709,7 +17711,7 @@ packages: express: 4.19.2 graceful-fs: 4.2.11 html-entities: 2.5.2 - http-proxy-middleware: 2.0.6_@types+express@4.17.21 + http-proxy-middleware: 2.0.7_@types+express@4.17.21 ipaddr.js: 2.2.0 launch-editor: 2.8.0 open: 8.4.2 @@ -17978,9 +17980,9 @@ packages: '@babel/core': 7.24.7 '@babel/preset-env': 7.24.7_@babel+core@7.24.7 '@babel/runtime': 7.24.7 - '@rollup/plugin-babel': 5.3.1_je4nbmfg47mhbnn75kmajdcj7i - '@rollup/plugin-node-resolve': 11.2.1_rollup@2.79.1 - '@rollup/plugin-replace': 2.4.2_rollup@2.79.1 + '@rollup/plugin-babel': 5.3.1_w6kn3gmbfhpa2ap3fyykp2cmt4 + '@rollup/plugin-node-resolve': 11.2.1_rollup@2.79.2 + '@rollup/plugin-replace': 2.4.2_rollup@2.79.2 '@surma/rollup-plugin-off-main-thread': 2.2.3 ajv: 8.16.0 common-tags: 1.8.2 @@ -17989,8 +17991,8 @@ packages: glob: 7.2.3 lodash: 4.17.21 pretty-bytes: 5.6.0 - rollup: 2.79.1 - rollup-plugin-terser: 7.0.2_rollup@2.79.1 + rollup: 2.79.2 + rollup-plugin-terser: 7.0.2_rollup@2.79.2 source-map: 0.8.0-beta.0 stringify-object: 3.3.0 strip-comments: 2.0.1 diff --git a/packages/templates/cra-template-desktop-viewer/template/.env b/packages/templates/cra-template-desktop-viewer/template/.env index 4505f791..490db576 100644 --- a/packages/templates/cra-template-desktop-viewer/template/.env +++ b/packages/templates/cra-template-desktop-viewer/template/.env @@ -1,5 +1,5 @@ # ---- Configuration ---- -ITWIN_VIEWER_SCOPE ="imodelaccess:read offline_access imodels:read itwins:read realitydata:read" +ITWIN_VIEWER_SCOPE ="itwin-platform offline_access" ITWIN_VIEWER_CLIENT_ID="" ITWIN_VIEWER_REDIRECT_URI="" ITWIN_VIEWER_ISSUER_URL="https://ims.bentley.com" diff --git a/packages/templates/cra-template-desktop-viewer/template/README.md b/packages/templates/cra-template-desktop-viewer/template/README.md index 0f857f8a..6a68a02c 100644 --- a/packages/templates/cra-template-desktop-viewer/template/README.md +++ b/packages/templates/cra-template-desktop-viewer/template/README.md @@ -12,12 +12,7 @@ ITWIN_VIEWER_CLIENT_ID="native-xxxxxxxx" - You should generate a [client](https://developer.bentley.com/register/) to get started. The client that you generate should be for a desktop app and use the following list of apis. You can add the default redirect uri (http://localhost:3000/signin-callback). -- Scopes expected by the viewer are: - - - **Visualization**: `imodelaccess:read` - - **iModels**: `imodels:read` - - **Reality Data**: `realitydata:read` - - **Administration**: `itwins:read` +- Viewer expects the `itwin-platform` scope to be set. ## Available Scripts diff --git a/packages/templates/cra-template-web-viewer/template/.env b/packages/templates/cra-template-web-viewer/template/.env index 6e7bd349..280a06f4 100644 --- a/packages/templates/cra-template-web-viewer/template/.env +++ b/packages/templates/cra-template-web-viewer/template/.env @@ -2,7 +2,7 @@ IMJS_AUTH_CLIENT_CLIENT_ID = "" IMJS_AUTH_CLIENT_REDIRECT_URI = "" IMJS_AUTH_CLIENT_LOGOUT_URI = "" -IMJS_AUTH_CLIENT_SCOPES ="imodelaccess:read imodels:read realitydata:read" +IMJS_AUTH_CLIENT_SCOPES ="itwin-platform" IMJS_AUTH_AUTHORITY="https://ims.bentley.com" # ---- Test ids ---- diff --git a/packages/templates/cra-template-web-viewer/template/README.md b/packages/templates/cra-template-web-viewer/template/README.md index 762a5bbc..1a48c518 100644 --- a/packages/templates/cra-template-web-viewer/template/README.md +++ b/packages/templates/cra-template-web-viewer/template/README.md @@ -11,16 +11,12 @@ Prior to running the app, you will need to add OIDC client configuration to the IMJS_AUTH_CLIENT_CLIENT_ID="" IMJS_AUTH_CLIENT_REDIRECT_URI="" IMJS_AUTH_CLIENT_LOGOUT_URI="" -IMJS_AUTH_CLIENT_SCOPES ="" +IMJS_AUTH_CLIENT_SCOPES="" ``` - You can generate a [test client](https://developer.bentley.com/tutorials/web-application-quick-start/#3-register-an-application) to get started. -- Scopes expected by the viewer are: - - - **Visualization**: `imodelaccess:read` - - **iModels**: `imodels:read` - - **Reality Data**: `realitydata:read` +- 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.