oktadev/schematics

Issue with a new empty Ionic 6, Angular 15 app on Android emulator/device

gsteindl opened this issue · 5 comments

After following the documented steps for setting up a new Ionic project, I am unable to authenticate with Okta on an Android device/emulator.

The app works fine from a web browser. It also works fine via iOS. It seems that the app on android thinks it's running on localhost and so Okta is refusing the auth request due to a bad redirect url. If I add http://localhost as a redirect url in Okta, the android app successfully redirects to Okta. However, after signing in with Okta the redirect back to the app then fails. This is obviously because the native app is not running on the web and so it can't resolve the redirect url from Okta of http://localhost.

Attached, is the starter project w/o node_modules. I simply added android to the project via capacitor. No custom content, additional plugins etc have been added. I'm just trying to get a starter project working with Okta from the web, ios and android.

Any ideas how to resolve this issue with android?
secure-ionic.zip

For Android, you need to add your reverse domain name as the android:scheme in AndroidManifest.yml:

https://github.com/oktadev/schematics#android

@gsteindl Please let me know if my comment above solved your problem.

I'm not sure you need http://localhost as a redirect. I do know that you need it as a trusted origin for Android.