public void SecurityTokenServiceGetSessionToken()
        {
            #region to-get-temporary-credentials-for-an-iam-user-or-an-aws-account-1480540814038

            var response = client.GetSessionToken(new GetSessionTokenRequest
            {
                DurationSeconds = 3600,
                SerialNumber    = "YourMFASerialNumber",
                TokenCode       = "123456"
            });

            Credentials credentials = response.Credentials;

            #endregion
        }
 private Amazon.SecurityToken.Model.GetSessionTokenResponse CallAWSServiceOperation(IAmazonSecurityTokenService client, Amazon.SecurityToken.Model.GetSessionTokenRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Security Token Service (STS)", "GetSessionToken");
     try
     {
         #if DESKTOP
         return(client.GetSessionToken(request));
         #elif CORECLR
         return(client.GetSessionTokenAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }