IONIC 6 Capacitor Android & iOS app and Azure AD auth open in external browser

I develop in Ionic 6 framework, Angular and Capacitor an App for Android & iOS. I would like to do authentication with Microsoft’s Azure AD without using Auth Connect module.I have integrated the example code at this link into my app: Tutorial: Create an Angular app that uses the Microsoft identity platform for authentication using auth code flow - Microsoft identity platform | Microsoft Docs

The app start with homepage and when I click on login button the code open Microsoft link in an external browser (example Chrome or Firefox). I do the login and when it was successful it sends me back in external browser with url localhost:8100 and it doesn’t go any further. I would like to ask if someone can help me to integrate the login function inside the app without going back to the localhost but to the home page of the app.

I’m trying the same thing, I manage using deeplinking and setting the redirect url on a specific url that points to the app so the authorize redirect to that url, close the external webview and return to the app.

Now my problem is that I get a “code” that should be used to get the access token but I’m not managing to do it.

Any help on this would be great.

Hello,
I had the same problem but it has been fixed by using this Capacitor plugin : GitHub - moberwasserlechner/capacitor-oauth2: Generic Capacitor OAuth 2 client plugin! Show your appreciation with a Github ★

Hope it will help you