loonix / capacitor-oauth2-azure-example

Capacitor Oauth2 Azure B2C Example
6 stars 2 forks source link

Deep Linking on Android is not working #3

Closed pksnz closed 2 years ago

pksnz commented 2 years ago

Describe the bug Deep Linking on Android is not working

To Reproduce Steps to reproduce the behavior:

  1. Implement Android as per instructions on GitHub.
  2. Provides user/pass on B2C screen presented.
  3. After authentication the screen doesn't redirect/go back to the main intent.

Expected behavior The Login intent should close after successful authentication and the Access Token is generated.

Screenshots Here is an example I got from chrome://inspect image

I also tried changing the Scheme to use com.mydomain.app://oauth and it has the same behaviour.

Smartphone (please complete the following information):

Additional context I have checked issues 96 and 91 and no luck. Appreciate any help on this.

Ermag commented 2 years ago

Facing the exact same issue, any luck finding the root cause?

Update: I managed to solve it, here is how:

  1. Change the value for the redirectUrl field in the oauth2Options as follows: From --> redirectUrl: 'com.your.appid://oauth/redirect, To --> redirectUrl: 'msauth.com.your.appid://auth'
  2. Change the value for the appAuthRedirectScheme in the android/app/build.gradle as follows: From --> "appAuthRedirectScheme": "com.your.appid" To --> "appAuthRedirectScheme": "msauth.com.your.appid"
pksnz commented 2 years ago

Thanks @Ermag. That worked!

loonix commented 2 years ago

Seems like you guys managed to solve this, closing this ticket. (Sorry I only saw this now and honestly I moved to flutter, so much better)