title: AWS ECR GetAuthorizationToken Issue
body: <p>I have Jenkins setup for deploying my docker images to a Amazon ECR repository.<br>
  I have enabled 2FA in my AWS account for the IAM user. I have attached all admin polices to my IAM User. I am following the below command to push my docker image source to Amazon ECR repository.    </p>
  
  <pre><code>aws sts get-session-token --serial-number arn-of-the-mfa-device --token-code code-from-token
  </code></pre>
  
  <p>Ref Link : <a href="https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/" rel="nofollow noreferrer">https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/</a></p>
  
  <p>Jenkins Code:</p>
  
  <pre><code>export aws configure
  
  export AWS_ACCESS_KEY_ID=AKIAJ6CAU****
  
  export AWS_SECRET_ACCESS_KEY=TRXaGmEHN5******
  
  export AWS_DEFAULT_REGION=eu-west-2
  
  $(aws ecr get-login --no-include-email --region eu-west-2)
  
  docker tag add-product:latest 06423123213.dkr.ecr.eu-west-2.amazonaws.com/add-product:$BUILD_NUMBER
  
  docker push 06423123213.dkr.ecr.eu-west-2.amazonaws.com/add-product:$BUILD_NUMBER
  </code></pre>
  
  <p>I have facing the issue when I deploy to Amazon ECR.</p>
  
  <ol>
  <li><p>"An error occurred (AccessDenied) when calling the GetSessionToken operation: Cannot call GetSessionToken with session credentials"</p></li>
  <li><p>"An error occurred (AccessDenied) when calling the GetSessionToken operation: MultiFactorAuthentication failed, unable to validate MFA code"</p></li>
  </ol>
  
  <p>Ref Link :
  <a href="https://stackoverflow.com/questions/38587325/aws-ecr-getauthorizationtoken">AWS ECR GetAuthorizationToken</a></p>