title: Logins don't match. Please include at least one valid login for this identity or identity pool
body: <p>I am trying to put login credentials like access token of auth0 login to amazon cognito and then try to upload a profile picture in my app. I am getting error from amazon like:</p>
  
  <pre><code>Logins don't match. Please include at least one valid login for this identity or identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: 0fafe672-2863-11e9-8f0e-cdc8b612afa1)
  </code></pre>
  
  <p><strong>UploadImageTask.java</strong></p>
  
  <pre><code>private class UploadImageTask extends AsyncTask&lt;Void, Demo, Demo&gt; {
          final ConditionVariable conditionVariable = new ConditionVariable(false);
          Demo demo = new Demo();
          File compressImage;
          private User user;
  
          UploadImageTask(User user) {
              this.user = user;
          }
  
          @Override
          protected Demo doInBackground(Void... params) {
              compressImage = new File(compressImage(user.getProfileUrl()));
              String uniqueId = UUID.randomUUID().toString();
              final String keyName = "user/" + uniqueId + Global.IMAGE_JPG_EXTENSION;
              CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
                      SettingsAccountActivity.this,
                      BuildConfig.AMAZON_POOL_ID,
                      Regions.fromName(BuildConfig.AMAZON_REGION));
              ClientConfiguration configuration = new ClientConfiguration();
              SessionManager sessionManager = new SessionManager(SettingsAccountActivity.this);
              String accessToken = sessionManager.getAuthToken().getAccess_Token();
              Map&lt;String, String&gt; logins = new HashMap&lt;&gt;();
              logins.put("myname.auth0.com", "Bearer "+ accessToken);
              AppLogger.d(getTag(), logins.toString());
              credentialsProvider.setLogins(logins);
              configuration.setMaxErrorRetry(3);
              configuration.setConnectionTimeout(501000);
              configuration.setSocketTimeout(501000);
              configuration.setProtocol(Protocol.HTTP);
              AmazonS3Client s3Client = new AmazonS3Client(credentialsProvider, configuration);
              if (BuildConfig.FLAVOR == Global.FLAVOR_PRO) {
                  s3Client.setRegion(Region.getRegion(Regions.fromName("us-east-2")));
              }
              TransferUtility transferUtility = new TransferUtility(s3Client, SettingsAccountActivity.this);
              ObjectMetadata objectMetadata = new ObjectMetadata();
              objectMetadata.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
              TransferObserver observer = transferUtility.upload(BuildConfig.BUCKET_NAME, keyName,
                      compressImage, objectMetadata);
              observer.setTransferListener(new TransferListener() {
                  @Override
                  public void onStateChanged(int id, TransferState state) {
                      if (state == TransferState.COMPLETED) {
                          user.setProfileUrl(keyName);
                          demo.setShow(true);
                          demo.setKeyName(keyName);
                          FutureTarget&lt;File&gt; futureTarget = Glide.with(getApplicationContext())
                                  .load(BuildConfig.AMAZON_URL + BuildConfig.BUCKET_NAME + "/" + keyName)
                                  .downloadOnly(1024, 1024);
                          new Thread(() -&gt; {
                              try {
                                  File file = futureTarget.get();
                                  String path = file.getAbsolutePath();
                                  AppLogger.d(getTag(), "----------------- cache Image: " + path);
                              } catch (InterruptedException | ExecutionException e) {
                                  AppLogger.e(getTag(), e.getMessage(), e);
                              }
                              conditionVariable.open();
                          }).start();
                      }
                  }
  
  
                  @Override
                  public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) {
                      AppLogger.d(getTag(), "--- is Uploading");
                  }
  
                  @Override
                  public void onError(int id, Exception ex) {
                      AppLogger.e(getTag(), ex.getMessage(), ex);
                      conditionVariable.open();
                      demo.setKeyName(keyName);
                      demo.setShow(false);
                  }
              });
              conditionVariable.block();
              return demo;
          }
  
          @Override
          protected void onPostExecute(Demo demo) {
              super.onPostExecute(demo);
              if (compressImage.exists() &amp;&amp; compressImage.delete()) {
                  AppLogger.d(getTag(), "Compress image deleted");
              }
              if (demo.isShow()) {
                  String keyName = demo.getKeyName();
                  AppLogger.d("Key name is:", keyName);
                  if (user.getProfileUrl().startsWith(Global.FIELD_HTTP) || user.getProfileUrl().startsWith(Global.FIELD_HTTPS)) {
                      url = user.getProfileUrl();
                      user.setProfileUrl(url);
                  } else {
                      url = BuildConfig.AMAZON_URL + BuildConfig.BUCKET_NAME + "/" + user.getProfileUrl();
                      user.setProfileUrl(url);
                      AppLogger.e("AMAZON URL:::", "url is:" + url);
                  }
                  Glide.with(getApplicationContext())
                          .load(url)
                          .transform(new GlideCircleTransform(getApplicationContext()))
                          .override(100, 200)
                          .diskCacheStrategy(DiskCacheStrategy.ALL)
                          .listener(new RequestListener&lt;String, GlideDrawable&gt;() {
                              @Override
                              public boolean onException(Exception e, String model, Target&lt;GlideDrawable&gt; target, boolean isFirstResource) {
                                  mProgressView.setVisibility(View.GONE);
                                  return false;
                              }
  
                              @Override
                              public boolean onResourceReady(GlideDrawable resource, String model, Target&lt;GlideDrawable&gt; target, boolean isFromMemoryCache, boolean isFirstResource) {
                                  mProgressView.setVisibility(View.GONE);
                                  return false;
                              }
                          })
                          .into(userAccountImage);
                  SessionManager manager = new SessionManager(SettingsAccountActivity.this);
                  manager.getAuthToken().getUser().setProfileUrl(url);
                  AuthToken token = manager.getAuthToken();
                  manager.startSession(token);
                  ApiClient apiClient = new ApiClient(SettingsAccountActivity.this);
                  apiClient.changeProfile(keyName, imageApiCallback);
  
              } else {
                  showProgress(false);
                  mProgressView.setVisibility(View.GONE);
                  //Toast.makeText(SettingsAccountActivity.this, getResources().getString(R.string.string_java_toast_error_in_adding_task), Toast.LENGTH_SHORT).show();
              }
          }
      }
  </code></pre>
  
  <p>I am doing this to upload image and try to put accesstoken to amazon cognito. But I am getting error and image is not getting upload.</p>
  
  <p><strong>ErrrLog</strong>:</p>
  
  <pre><code>2019-02-04 15:25:53.776 23419-25377/com.visualogyx.app.dev E/CognitoCachingCredentialsProvider: Failure to get credentials
      com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Logins don't match. Please include at least one valid login for this identity or identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: 0fafe672-2863-11e9-8f0e-cdc8b612afa1)
          at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:729)
          at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405)
          at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212)
          at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.invoke(AmazonCognitoIdentityClient.java:559)
          at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.getId(AmazonCognitoIdentityClient.java:445)
          at com.amazonaws.auth.AWSAbstractCognitoIdentityProvider.getIdentityId(AWSAbstractCognitoIdentityProvider.java:172)
          at com.amazonaws.auth.AWSEnhancedCognitoIdentityProvider.refresh(AWSEnhancedCognitoIdentityProvider.java:76)
          at com.amazonaws.auth.CognitoCredentialsProvider.startSession(CognitoCredentialsProvider.java:601)
          at com.amazonaws.auth.CognitoCredentialsProvider.getCredentials(CognitoCredentialsProvider.java:388)
          at com.amazonaws.auth.CognitoCachingCredentialsProvider.getCredentials(CognitoCachingCredentialsProvider.java:442)
          at com.amazonaws.auth.CognitoCachingCredentialsProvider.getCredentials(CognitoCachingCredentialsProvider.java:76)
          at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4619)
          at com.amazonaws.services.s3.AmazonS3Client.getBucketRegionViaHeadRequest(AmazonS3Client.java:5377)
          at com.amazonaws.services.s3.AmazonS3Client.fetchRegionFromCache(AmazonS3Client.java:5352)
          at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4616)
          at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1728)
          at com.amazonaws.mobileconnectors.s3.transferutility.UploadTask.uploadSinglePartAndWaitForCompletion(UploadTask.java:214)
          at com.amazonaws.mobileconnectors.s3.transferutility.UploadTask.call(UploadTask.java:88)
          at com.amazonaws.mobileconnectors.s3.transferutility.UploadTask.call(UploadTask.java:47)
          at java.util.concurrent.FutureTask.run(FutureTask.java:237)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
          at java.lang.Thread.run(Thread.java:761)
  </code></pre>
  
  <p>can someone help me to resolve this issue? 
  I have already visit the amazon forums ans and try this:
  <a href="https://forums.aws.amazon.com/thread.jspa?threadID=243850" rel="nofollow noreferrer">https://forums.aws.amazon.com/thread.jspa?threadID=243850</a> but didn't work.</p>
  
  <p>Thanks.</p>