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

aws-android-sdk-auth-userpools does not support forced change password flow #374

Closed
akki1997 opened this issue Nov 20, 2017 · 16 comments
Closed
Assignees
Labels
closing soon Issue will auto-close if there is no additional activity within 7 days. cognito Issues with the AWS Android SDK for Cognito feature-request Request a new feature pending-community-response Issue is pending response from the issue requestor

Comments

@akki1997
Copy link

StackTrace-
FATAL EXCEPTION: main
Process: com.example.aksshita.toll, PID: 4082
java.lang.UnsupportedOperationException: Not supported in this sample.
at com.amazonaws.mobile.auth.userpools.CognitoUserPoolsSignInProvider$6.authenticationChallenge(CognitoUserPoolsSignInProvider.java:331)
at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$28.run(CognitoUser.java:2108)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

@mutablealligator
Copy link
Contributor

mutablealligator commented Nov 20, 2017

Hi @akki1997,

Thanks for reporting to us. Are you trying to sign-in with the temporary password created by a UserPool Admin? The Amazon Cognito UserPools SDK (aws-sdk-android-cognitoidentityprovider) has the API that lets the user change password for the first time the user signs in. But, the Auth UserPools SDK (aws-sdk-android-auth-userpools), which has the SignIn UI doesn't support the use case, where a user with temporary credentials signs in and requires changing the password.

We will take it as a feature request.

For more information to signing-in as an admin created user, refer this documentation: http://docs.aws.amazon.com/cognito/latest/developerguide/using-amazon-cognito-user-identity-pools-android-sdk-authenticate-admin-created-user.html

@mutablealligator mutablealligator added the feature-request Request a new feature label Nov 20, 2017
@akki1997
Copy link
Author

akki1997 commented Nov 20, 2017 via email

@mutablealligator
Copy link
Contributor

Sorry for the inconvenience caused. Currently, the Auth UserPools SDK (aws-sdk-anroid-auth-userpools) with the SignIn UI doesn't support this use-case. We are taking it as a feature request.

@akki1997
Copy link
Author

akki1997 commented Nov 21, 2017 via email

@aws-amplify aws-amplify deleted a comment from kredden Feb 8, 2018
@aws-amplify aws-amplify deleted a comment from akki1997 Feb 8, 2018
@kopevgale
Copy link

who can explain how to remove the issue? I get the same error

@Nthalk
Copy link

Nthalk commented Mar 11, 2018

Using the latest version, this still happens.

What's worse, is that the Cognito android tutorials will eventually lead you here (https://docs.aws.amazon.com/aws-mobile/latest/developerguide/getting-started.html)

The primary issue is that the Cognito user pool, when creating a user, defaults to an unchangeable status of "Enabled / FORCE_CHANGE_PASSWORD".

If your only endpoint is an Android application, then this will just crash your app every time it happens.

@kopevgale because of how this is implemented, it seems impossible to override this behavior.

You can, however get around this, buy not using UserPools and moving to OAUTH (which is what I'm about to do).

@danleahy
Copy link

Any update, just trying the tutorial myself, got the dreaded
java.lang.UnsupportedOperationException: Not supported in this sample.
Error

What is the fix/workaround ?

@fahlmant
Copy link

I'm getting the same issue. Please look at fixing this.

@danleahy
Copy link

Just tried this different tutorial
https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-integrating-user-pools-android.html
demo doesn't use best practices, like putting the secret key in the app code?
just tried it and it doesn't crash

@iamdeadman
Copy link

iamdeadman commented May 19, 2018

Having the same issue here,
@danleahy did you manage to solve this issue with this itself - https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-integrating-user-pools-android.html

Or you found any alternatives for this issue ?

@pacifire
Copy link

Still facing the same issue & no workaround has been found.
At least Amazon AWS should help us here....

@ringonotts
Copy link

OK, so this all fails because the AWSStartupHandler does not have the authenticationChallenge callback implemented. Apparently this is a feature request now.


@kvasukib tells us to have a look at
https://docs.aws.amazon.com/cognito/latest/developerguide/using-amazon-cognito-user-identity-pools-android-sdk-authenticate-admin-created-user.html

This tells us

you must implement the AuthenticationChallenge callback method

As far as I can tell, AuthenticationChallenge is part of the the AuthenticationHandler interface. So i've implemented this as part of my main activity:
public class MainActivity extends AppCompatActivity implements AuthenticationHandler{

And then overidden the other API's as well as authenticationChallenge API.

However, i still get the same error. Any thoughts on what i'm doing wrong please ?

TIA, Ringo

@ringonotts
Copy link

ringonotts commented Sep 5, 2018

I'm not sure why this was so hard to figure out but until this feature is fixed, then the guidance on the "welcome to Mobile AWS" (https://docs.aws.amazon.com/aws-mobile/latest/developerguide/add-aws-mobile-user-sign-in.html) should really be changed until this feature is fully implemented.

So, for future reference, and for any other poor soal just following instructions only to find out you get here, just take a look at the sample applications here:

https://github.com/awslabs/aws-sdk-android-samples

There is a great sample called "AmazonCognitoYourUserPoolsDemo" which works. Yes, its a lot more complicated (i.e. its normal), but it works.

HTH's..

@frankmuellr frankmuellr added cognito Issues with the AWS Android SDK for Cognito and removed Auth labels Sep 28, 2018
@minbi minbi self-assigned this Oct 19, 2018
@minbi
Copy link
Contributor

minbi commented Oct 19, 2018

Hi,

We are looking into this issue now.

@minbi minbi changed the title App crashing after signing in using AWS Mobile hub instead of going to the next activity.Using the sample code provided. aws-android-sdk-auth-userpools does not support forced change password flow Oct 19, 2018
@minbi minbi added investigating pending-release Code has been merged but pending release labels Oct 19, 2018
@minbi
Copy link
Contributor

minbi commented Oct 23, 2018

Hi @akki1997 @kopevgale @Nthalk @danleahy @iamdeadman @pacifire @ringonotts ,

Please see if SDK release 2.7.6 fixes this issue for you. We have added the following enhancements:

  • Added support for forced changed password in the sign-in flow of the UI.

You may see all changes in the changelog

@minbi minbi added pending-community-response Issue is pending response from the issue requestor and removed investigating labels Oct 23, 2018
@minbi minbi added closing soon Issue will auto-close if there is no additional activity within 7 days. and removed pending-release Code has been merged but pending release labels Oct 23, 2018
@minbi
Copy link
Contributor

minbi commented Oct 31, 2018

Hi,

We are closing this issue because there has been no activity. Please feel free to open a new issue if the problem persists. We ask this because closed issues are not actively monitored.

Thanks

@minbi minbi closed this as completed Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing soon Issue will auto-close if there is no additional activity within 7 days. cognito Issues with the AWS Android SDK for Cognito feature-request Request a new feature pending-community-response Issue is pending response from the issue requestor
Projects
None yet
Development

No branches or pull requests