code: public static GitLabApi oauth2Login(String url, String username, char[] password) throws GitLabApiException {
  
          try (SecretString secretPassword = new SecretString(password)) {
              return (GitLabApi.oauth2Login(ApiVersion.V4, url, username, secretPassword, null, null, false));
          }
      }
docs: <p>Logs into GitLab using OAuth2 with the provided {@code username} and {@code password},
  and creates a new {@code GitLabApi} instance using returned access token.</p>
  
  @param url GitLab URL
  @param username user name for which private token should be obtained
  @param password a char array holding the password for a given {@code username}
  @return new {@code GitLabApi} instance configured for a user-specific token
  @throws GitLabApiException GitLabApiException if any exception occurs during execution