iTwin / viewer

Monorepo that contains the iTwin Viewer npm packages and their related packages
MIT License
26 stars 15 forks source link

iTwin Regeistration step #332

Closed Yousef00109 closed 1 week ago

Yousef00109 commented 1 week ago

Hey all,

i have my own itwin model. i have upload my model. i am in the step of viewing my moodel on itwiviwer. hower when i am following the step of registartion of my moodel as below i can't see my moodel and get the error message.

Here is the code that i am using

---- Authorization Client Settings ----

IMJS_AUTH_CLIENT_CLIENT_ID=spa-PObF4Xs0AZ8a6he1TRMYMnbaw IMJS_AUTH_CLIENT_REDIRECT_URI=https://localhost:3000/signin-callback IMJS_AUTH_CLIENT_LOGOUT_URI= IMJS_AUTH_CLIENT_SCOPES="itwin-platform" IMJS_AUTH_AUTHORITY="https://ims.bentley.com"

Please if anyone have the solution of this probelm

aruniverse commented 1 week ago

Hi! What is the error message you are seeing?

Yousef00109 commented 1 week ago

Hello,

I'm no longer seeing an error message, but my model still isn't displaying in the iTwin Viewer. Instead, I only see a white screen.

here is my code :

IMJS_AUTH_CLIENT_CLIENT_ID = spa-PObF4Xs0AZ8a6he1TRMYMnbaw IMJS_AUTH_CLIENT_REDIRECT_URI = http://localhost:3000/?itwinid=61ad2924-6144-42dd-b3e5-826e1148ee9f&imodelid=1459d74e-e78d-4e79-976e-78c56b6efa9f IMJS_AUTH_CLIENT_LOGOUT_URI = IMJS_AUTH_CLIENT_SCOPES ="imodelaccess:read imodels:read realitydata:read" IMJS_AUTH_AUTHORITY="https://ims.bentley.com"

Yousef00109 commented 1 week ago

this is the error now :

Uncaught Error: Please add a valid OIDC client id to the .env file and restart the application. See the README for more information. at ./src/index.tsx (index.tsx:16:9) at options.factory (react refresh:6:1) at __webpack_require__ (bootstrap:22:1) at startup:7:1 at startup:7:1

DanRod1999 commented 1 week ago

I believe you shared with the contents of your .env file. Does the rest of your env file follow the format of the template .env files?

# ---- Authorization Client Settings ----
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_AUTHORITY="https://ims.bentley.com"

# ---- Test ids ----
IMJS_ITWIN_ID = ""
IMJS_IMODEL_ID = ""

# Advanced CRA Config: https://create-react-app.dev/docs/advanced-configuration/
SKIP_PREFLIGHT_CHECK=true

# Advanced iTwin.js CRA Config: https://github.com/imodeljs/create-react-app/blob/imodeljs/packages/react-scripts/README-imodeljs.md
USE_FAST_SASS=true
USE_FULL_SOURCEMAP=true
TRANSPILE_DEPS=false
# Remove the following env var if using a different package manager
USING_NPM=true

Did you change anything that then caused the error you just shared?

Yousef00109 commented 1 week ago

Hello,

I haven't made any changes, but I'm trying to view my iModel in the iTwin Viewer and am encountering an issue. I followed all the steps, but I can't figure out why it's not working.

I created the npm folder on my laptop. I registered the app for my iModel. However, when I run the code, my iModel does not appear in the iTwin Viewer.

DanRod1999 commented 1 week ago

I would double check the contents or your .env file. It seems to me based on the snippet you sent in your env that you might be missing some fields. For example you don't have these fields: IMJS_ITWIN_ID = "" IMJS_IMODEL_ID = ""

and in your IMJS_AUTH_CLIENT_REDIRECT_URI you have some content that I wouldn't expect. It should contain this "http://localhost:3000/signin-callback"

Instead it contains your imodel and itwin id. I would follow this document if you are still unsure about any of your settings https://www.itwinjs.org/learning/tutorials/develop-web-viewer/

Yousef00109 commented 1 week ago

hello.

here is the full code that I used and I still face the same issue. I don't see imodel in the itwin viewer

---- Authorization Client Settings ----

IMJS_AUTH_CLIENT_CLIENT_ID =spa-kv42VAvha3EaMixqKm1n5iVSv IMJS_AUTH_CLIENT_REDIRECT_URI=http://localhost:3000/signin-callback IMJS_AUTH_CLIENT_LOGOUT_URI=http://localhost:3000/logout IMJS_AUTH_CLIENT_SCOPES="itwin-platform" IMJS_AUTH_AUTHORITY="https://ims.bentley.com"

---- Test ids ----

IMJS_ITWIN_ID=61ad2924-6144-42dd-b3e5-826e1148ee9f IMJS_IMODEL_ID=1459d74e-e78d-4e79-976e-78c56b6efa9f

Advanced CRA Config: https://create-react-app.dev/docs/advanced-configuration/

SKIP_PREFLIGHT_CHECK=true

Advanced iTwin.js CRA Config: https://github.com/imodeljs/create-react-app/blob/imodeljs/packages/react-scripts/README-imodeljs.md

USE_FAST_SASS=true USE_FULL_SOURCEMAP=true TRANSPILE_DEPS=false

Remove the following env var if using a different package manager

USING_NPM=true

After i run this code, get only this on my browser: http://localhost:3000/

Yousef00109 commented 1 week ago

here also the error from the browser

if (!process.env.IMJS_AUTH_CLIENT_CLIENT_ID) { throw new Error( "Please add a valid OIDC client id to the .env file and restart the application. See the README for more information." ); } if (!process.env.IMJS_AUTH_CLIENT_SCOPES) { throw new Error( "Please add valid scopes for your OIDC client to the .env file and restart the application. See the README for more information." ); } if (!process.env.IMJS_AUTH_CLIENT_REDIRECT_URI) { throw new Error( "Please add a valid redirect URI to the .env file and restart the application. See the README for more information." );

Yousef00109 commented 1 week ago

Hello All,

Thanks so much for your help, the problem has been solved.