AWS Cognito Authentication in Javascript

for my web application I need to login towards AWS Cognito.
But other parts of my website requires the authorization code.

So, this is my code:

    function signInButton() {
      var authenticationData = {
        Username : document.getElementById("inputUserName").value,
        Password : document.getElementById("inputPassword").value,
      };

      var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData);

      var poolData = {
        UserPoolId : _config.cognito.userPoolId,
        ClientId : _config.cognito.clientID,
        ClientSecret : _config.cognito.clientSecret,
      };

      var userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);

      var userData = {
        Username : document.getElementById("inputUserName").value,
        Pool : userPool,
      };

      var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);

      cognitoUser.authenticateUser(authenticationDetails, {
        onSuccess: function (result) {
          var accessToken = result.getAccessToken().getJwtToken();
          console.log(accessToken);
          console.log(result);
        },

        onFailure: function (err) {
          alert(err.message || JSON.stringify(err));
          console.log(userData);
        },
      });
    }

I get successfully the token, but how can I obtain the authCode?