0

At the moment I'm working on an interesting project with Angular. My company mainly develops for Microsoft Business Central and want me to embed an Angular app inside a Business Central component.

I think the target group for Business Central developers is quite small but I think you will run in the same kind of problem when embedding the Angular App in another application like wordpress etc.

So I've created a ng new project (with routing) and implemented authentication with Azure B2C as identity provider (with a browser popup to enter your credentials). And I've created a component to test the routing (/home).

When running the app with ng serve the login flow works and I'm authenticated. But after building the project and embedding it in an Business Central Extension, I'm able to click on the navigation menu to switch routes to "/" and "/home" but my authentication doesn't work.

This makes completely sense because of I don't have a proper URL behind my application since it's embedded. So the redirect URL is unknown. Also unknown to me because the window.location.origin mentions I'm on https://businesscentral.dynamics.com and Angular has it's active route on "/home" or "/".

So I'm not able to call some resource or hit an URL registered by the Angular routes from outside Business Central...

What are my options to get the authentication working, if there actually are? For the authentication I'm using "angular-oauth2-oidc" and the Authorization Code flow with PXCE.

Below a screenshot of Angular running inside Business Central enter image description here

Ferry Jongmans
  • 625
  • 2
  • 12
  • 22
  • Have you registered your business central url in B2C as a valid callback url? How are you embedding the application? – John Jun 27 '20 at 14:09
  • Yes, I have a valid callback URL registered in B2C. The application is embedded via a control add-in. So the compiled Angular files are loaded from the Images folder in Business Central. See: (https://jeremy.vyska.info/2018/11/post-1-angular-inside-dynamics-365-business-central/1827) – Ferry Jongmans Jun 28 '20 at 10:02

0 Answers0