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

RunInBackground flag does not work #668

Closed
mehmetkemalbayer opened this issue Jan 21, 2019 · 5 comments
Closed

RunInBackground flag does not work #668

mehmetkemalbayer opened this issue Jan 21, 2019 · 5 comments
Assignees
Labels
bug Something isn't working cognito Issues with the AWS Android SDK for Cognito pending-release Code has been merged but pending release

Comments

@mehmetkemalbayer
Copy link

mehmetkemalbayer commented Jan 21, 2019

Why does runinbackground get network in main thread error on android?
Which AWS Services are you utilizing?
AWS Cognito user.initiateUserAuthentication
Provide code snippets (if applicable)

AuthenticationDetails authenticationDetails = new AuthenticationDetails(phoneNumber, new HashMap<String, String>(), new HashMap<String, String>());
                String secretHash = CognitoSecretHash.getSecretHash(phoneNumber, clientId, clientSecret);
                authenticationDetails.setAuthenticationParameter(CognitoServiceConstants.AUTH_PARAM_USERNAME, phoneNumber);
                authenticationDetails.setAuthenticationParameter(CognitoServiceConstants.AUTH_PARAM_SECRET_HASH, secretHash);

        user.initiateUserAuthentication(authenticationDetails, new AuthenticationHandler() {
            @Override
            public void onSuccess(CognitoUserSession userSession, CognitoDevice newDevice) {
                Log.d(TAG, "Success");
            }

            @Override
            public void getAuthenticationDetails(AuthenticationContinuation authenticationContinuation, String userId) {
                Log.d(TAG, "details");
            }

            @Override
            public void getMFACode(MultiFactorAuthenticationContinuation continuation) {
                Log.d(TAG, "mfa");
            }

            @Override
            public void authenticationChallenge(ChallengeContinuation continuation) {
                Intent intent = new Intent(context, LoginSmsActivity.class);
                context.startActivity(intent);
            }

            @Override
            public void onFailure(Exception exception) {
                Log.d(TAG, "Failure");
            }
        }, true).run();

Environment(please complete the following information):
aws-android-sdk-auth-userpools:2.6.+@aar'

Device Information (please complete the following information):
Nexus 6 API 24

@mehmetkemalbayer mehmetkemalbayer changed the title RunInBackgroun does not work RunInBackground flag does not work Jan 21, 2019
@palpatim palpatim added question General question cognito Issues with the AWS Android SDK for Cognito pending-community-response Issue is pending response from the issue requestor labels Jan 21, 2019
@minbi
Copy link
Contributor

minbi commented Jan 21, 2019

Hi @mehmetkemalbayer ,

We have identified at least one flow that does not respect the flag. Which flow are you using? or could you provide a stacktrace?

@minbi minbi added the bug Something isn't working label Jan 21, 2019
@palpatim palpatim removed the question General question label Jan 21, 2019
@mehmetkemalbayer
Copy link
Author

Hi @minbi,
As I mentioned in previous post it is custom auth flow. I'm trying to implement password-less login. I'm getting error while calling "user.initiateUserAuthentication" method. By the way I could not find a way to implement custom auth flow with AWSMobileClient. If there is another way that I miss please tell me.
Moreover there is a problem if you call a app client with app secret. First call cannot generate hash because there is no internal username and it gets "user Id cannot be null" error from CognitoHash class. If you generate hash manually and give as a parameter then respondtochallange gets error and it is something like hash is not correct.

@scb01 scb01 removed the pending-community-response Issue is pending response from the issue requestor label Jan 28, 2019
@minbi
Copy link
Contributor

minbi commented Feb 8, 2019

Hi @mehmetkemalbayer ,

We are addressing a few issues in the custom auth flow in an upcoming release.

For the namesake issue, we are still working on fixing the NetworkOnMainThread issue. If you need an urgent fix you will need to wrap the call in a background thread. We are also open to pull requests.

@minbi minbi added the pending-release Code has been merged but pending release label Feb 8, 2019
@minbi
Copy link
Contributor

minbi commented Feb 11, 2019

Hi @mehmetkemalbayer ,

We have released version 2.12.0 of the SDK. Please see if this fixes the "user Id cannot be null" error in the custom auth flow. Please stay tune for fixes to the NetworkOnMainThread issue.

@minbi minbi added the pending-community-response Issue is pending response from the issue requestor label Feb 11, 2019
@minbi
Copy link
Contributor

minbi commented Feb 15, 2019

Hi @mehmetkemalbayer ,

We have fix pending for this issue, please check it out if you are interested on #702

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cognito Issues with the AWS Android SDK for Cognito pending-release Code has been merged but pending release
Projects
None yet
Development

No branches or pull requests

4 participants