How do I exit AWS cognito – Android?

So this is the code I use to sign my user awareness (I hope I'm correct). Now, how do I exit? At present, I have my own registration process (so I don't have Facebook or Google)

 // Callback handler for the sign-in process
    private AuthenticationHandler authenticationHandler = new AuthenticationHandler()
    {
        @Override
        public void onSuccess(CognitoUserSession userSession, CognitoDevice newDevice)
        {
            Log.d(COGNITO_LOGIN,"Login success!");
            cognitoUser.getDetailsInBackground(getDetailsHandler);
            //Now we get user from dynamoDB and store it into a local user object. 
        }
        @Override
        public void getAuthenticationDetails(AuthenticationContinuation authenticationContinuation, String userId)
        {
            Log.d(COGNITO_LOGIN,passwordET.getText().toString());
            // The API needs user sign-in credentials to continue
            AuthenticationDetails authenticationDetails = new AuthenticationDetails(userId, passwordET.getText().toString(), null);

            // Pass the user sign-in credentials to the continuation
            authenticationContinuation.setAuthenticationDetails(authenticationDetails);

            // Allow the sign-in to continue
            authenticationContinuation.continueTask();
        }
        @Override
        public void getMFACode(MultiFactorAuthenticationContinuation multiFactorAuthenticationContinuation) {
            // Multi-factor authentication is required; get the verification code from user
            multiFactorAuthenticationContinuation.setMfaCode("verificationCode");
            // Allow the sign-in process to continue
            multiFactorAuthenticationContinuation.continueTask();
        }
        @Override
        public void authenticationChallenge(ChallengeContinuation continuation) {
        }
        @Override
        public void onFailure(Exception exception)
        {
            // Sign-in Failed, check exception for the cause
            Log.d(COGNITO_LOGIN,"Login Failed!");
            Log.d(COGNITO_LOGIN,exception.getMessage());
        }
    };
 cognitoUser.getSessionInBackground(authenticationHandler);

resolvent:

There is a way to erase or clear the current recorded user's session. Here are the methods I found

This is for fb in federated identities 
  if (fbAccessToken != null) {
                                    LoginManager.getInstance().logout();
                                }
This is for twiiter 
                                if (mAuthManager != null) {
                                      mAuthManager.clearAuthorizationState(null);
                                }

                                // wipe data
                                CognitoSyncClientManager.getInstance()
                                        .wipeData();

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>