Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Auth] Support basic sign in and hosted UI sign in in same app #1180

Closed
haverchuck opened this issue Feb 18, 2021 · 16 comments
Closed

[Auth] Support basic sign in and hosted UI sign in in same app #1180

haverchuck opened this issue Feb 18, 2021 · 16 comments
Labels
auth Related to the Auth category/plugins closing soon This issue will be closed in 7 days unless further comments are made. feature-request Request a new feature

Comments

@haverchuck
Copy link
Contributor

  1. A short description

When a user signs in using the standard Auth APIs, but the amplify configuration includes OAuth values, the user is briefly presented with a chrome custom tab when attempting to sign out. Signout appears to happen successfully, but the UX is jarring.

  1. The version of Amplify Android you're using
    1.16.13

  2. The code you're using to call Amplify Android

 private fun onSignOut (@NonNull flutterResult: Result) {
    try {
      Amplify.Auth.signOut(
              {  -> prepareSignOutResult(flutterResult)},
              { error -> errorHandler.handleAuthError(flutterResult, error)}
      );
    } catch (e: Exception) {
      errorHandler.prepareGenericException(flutterResult, e)
    }
  }
  1. Any relevant logs

Note: This is being run within amplify-flutter.

W/AWSMobileClient(12847): Failed to parse HostedUI settings from store. Defaulting to awsconfiguration.json
W/AWSMobileClient(12847): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
W/AWSMobileClient(12847): 	at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:121)
W/AWSMobileClient(12847): 	at org.json.JSONTokener.nextValue(JSONTokener.java:98)
W/AWSMobileClient(12847): 	at org.json.JSONObject.<init>(JSONObject.java:165)
W/AWSMobileClient(12847): 	at org.json.JSONObject.<init>(JSONObject.java:182)
W/AWSMobileClient(12847): 	at com.amazonaws.mobile.client.AWSMobileClient.getHostedUIJSON(AWSMobileClient.java:682)
W/AWSMobileClient(12847): 	at com.amazonaws.mobile.client.AWSMobileClient$2.run(AWSMobileClient.java:583)
W/AWSMobileClient(12847): 	at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
W/AWSMobileClient(12847): 	at java.lang.Thread.run(Thread.java:923)
D/AWSMobileClient(12847): initialize: Cognito HostedUI client detected
D/AWSMobileClient(12847): Inspecting user state details
I/amplify:flutter:auth_cognito_hub_evnet_stream_handler(12847): AuthPlugin successfully initialized
D/AWSMobileClient(12847): Inspecting user state details
I/TetheringManager(12847): registerTetheringEventCallback:com.amazonaws.amplify.amplify_auth_cognito_example
D/AWSMobileClient(12847): Inspecting user state details
D/AWSMobileClient(12847): waitForSignIn: userState:SIGNED_OUT
D/IdentityManager(12847): Signing out...
D/AWSMobileClient(12847): Inspecting user state details

Please use syntax highlighting for any code/logs.

@haverchuck haverchuck added the bug Something isn't working label Feb 18, 2021
@richardmcclellan
Copy link
Contributor

When a user signs in using the standard Auth APIs

Did you use Amplify.Auth.signIn or Amplify.Auth.signInWithWebUi?

@haverchuck
Copy link
Contributor Author

@richardmcclellan I used Amplify.Auth.signIn. This behavior is NOT observed if I remove the OAuth block from the amplifyconfiguration file.

@richardmcclellan
Copy link
Contributor

richardmcclellan commented Feb 18, 2021

Got it. I believe this is a limitation of AWSMobileClient - we don't support basic sign in and hosted UI sign in in the same app, you have to choose one or the other. It will require a non-trivial amount of work to enable it (probably a full re-write) Do you know of customers asking for this functionality?

@kjones
Copy link
Contributor

kjones commented Feb 18, 2021

We definitely need this and I think many other apps would also. Most apps present, SSO options as well as a sign-up/sign-in with username/password.

@raphire08
Copy link

Yeah, we would love to have this feature for Flutter library. We are facing the issue on android side only.

@ekarmazin
Copy link

Supporting this feature request, would be great to use at least hosted UI + socials

@CamronLDNF
Copy link

CamronLDNF commented Apr 15, 2021

Yes prrrrlease, we need this feature! I've spent quite some time moving from a different provider to Amplify Flutter (which I understand is based on Amplify Android) with the belief that basic sign-in and hosted social sign-in is supported. And only while researching this bug that I encountered, I learned that the root cause of the bug is that basic sign-in + hosted UI for social sign-in isn't supported. Gah! So yes, we need this feature.

@Lettly
Copy link

Lettly commented Oct 29, 2021

+1

1 similar comment
@niyonx
Copy link

niyonx commented Dec 13, 2021

+1

@artahc
Copy link

artahc commented Jan 10, 2022

+1

@rajd90
Copy link

rajd90 commented Feb 4, 2022

+1
I need this for my flutter app aws-amplify/amplify-flutter#1207

@MohsinJamadar09
Copy link

Got it. I believe this is a limitation of AWSMobileClient - we don't support basic sign in and hosted UI sign in in the same app, you have to choose one or the other. It will require a non-trivial amount of work to enable it (probably a full re-write) Do you know of customers asking for this functionality?

Hi,

I want to use hosted UI signIn, I have also kept OAuth block in amplifyConfiguration.
but still I am getting this error
Failed to parse HostedUI settings from store. Defaulting to awsconfiguration.json

I am using Amplify.Auth.signInWithWebUI

could you please help what I am missing?

@RaviJarwal
Copy link

+1

1 similar comment
@Papashkin
Copy link

+1

@gpanshu
Copy link
Contributor

gpanshu commented Nov 22, 2022

Hello @haverchuck if upgrade is an option for you and your users I would recommend upgrading to our V2 library where you can supply the option that you would like to sign in with even if you have something else in your configuration.

https://docs.amplify.aws/lib/q/platform/android/

val options = AWSCognitoAuthSignInOptions.builder().authFlowType(AuthFlowType.USER_SRP_AUTH).build()

@gpanshu gpanshu added the closing soon This issue will be closed in 7 days unless further comments are made. label Nov 22, 2022
@gpanshu gpanshu closed this as completed Dec 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Related to the Auth category/plugins closing soon This issue will be closed in 7 days unless further comments are made. feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests