crasht3st
crasht3st

Reputation: 21

I get a black screen when attempting to sign in via sso in my flutter app

I am calling the authorize method of the flutter_appAuth package on android.

Here is what that method looks like:

final result = await FlutterAppAuth().authorize(
    AuthorizationRequest(
      SSOConstants.clientId,
      SSOConstants.redirectUri,
      serviceConfiguration: AuthorizationServiceConfiguration(
        authorizationEndpoint: SSOConstants.authorizationEndpoint,
        tokenEndpoint: SSOConstants.tokenEndpoint,
      ),
      scopes: SSOConstants.scopes.split(' '),
    ),
  );

After I call the authorize method, I get redirected to 'login.microsoftonline.com' and I either get a black screen or a glitchy screen. It seems to just hang there after it is done loading. I get no error returned or no feedback about what went wrong.

Here is what the screen shows: enter image description here

Here is my build.gradle line:

    manifestPlaceholders = [
        'appAuthRedirectScheme': 'msauth' 
    ]

The format of my uri is:

msauth://com.example.test/1234

I do not get back any errors. There is no exception. All I get is this in the debug console:

D/EGL_emulation( 3984): app_time_stats: avg=901.00ms min=331.03ms max=1470.97ms count=2

D/EGL_emulation( 3984): app_time_stats: avg=145.78ms min=50.38ms max=439.36ms count=7 W/allc.myunifycrm( 3984): Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed) W/allc.myunifycrm( 3984): Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed) W/Parcel ( 3984): Expecting binder but got null! D/EGL_emulation( 3984): app_time_stats: avg=67.71ms min=30.60ms max=203.09ms count=15 D/EGL_emulation( 3984): app_time_stats: avg=113.54ms min=41.58ms max=378.01ms count=9

I am trying to sign in with SSO on my mobile app in local host, but I just get a black or glitched screen when attempting to sign in instead of the account picker or microsoft sign in dialogue. Also, iOS works fine.

Upvotes: 0

Views: 207

Answers (1)

crasht3st
crasht3st

Reputation: 21

UPDATE: so it turns out that this issue had nothing to do with the package or configurations in azure.

The reason why I was getting a black or glitchy screen when I would call the Authorize method is because of the settings on my android emulator. You can change those here: enter image description here

Also, once I fixed that and was able to see the prompts for signing in to Microsoft. I was getting a connection refused or handshake error because I was running my flutter app locally and trying to point it to talk to my API that is also running locally, so I had to add the line mentioned here: https://stackoverflow.com/a/50991257/22960720

Upvotes: 0

Related Questions