iTwin / connector-samples

iTwin Connector Samples
MIT License
5 stars 2 forks source link

Error on Itwin connection #5

Open lmborione opened 2 years ago

lmborione commented 2 years ago

When trying to connect with my application clientId, I got an error "400 - Invalid client_id" in my web browser. I fix this issue by changing the issuerUrl to "https://ims.bentley.com".

Also, could we use a connector in a service application (not a SPA) ?

Thanks

ziyzhu commented 2 years ago

@lmborione Sorry for the late reply! Yes, you can use a service application to do a non-interactive sign-in. SPA was used to support interactive sign-in through your Bentley account.

Note that @itwin/pcf@0.1.2 does not integrate service application sign-in, but it's available in @itwin/pcf@0.2.0-0.

An example:

// in your pcf.HubArgs definition under App.ts
clientConfig: { 
      clientId: process.env.imjs_test_client_id as string,
      // PCF would automatically do a non-interactive sign-in if this property is defined.
      clientSecret: process.env.imjs_test_client_secret as string, 
      redirectUri: "http://localhost:3000/signin-callback",
      scope: "itwinjs",
},