getAuthenticationUrl(redirectUri, state, authType = 'token', tokenAccessType = null, scope = null, includeGrantedScopes = 'none', usePKCE = false) {
    const clientId = this.getClientId();
    const baseUrl = OAuth2AuthorizationUrl(this.domain);

    if (!clientId) {
      throw new Error('A client id is required. You can set the client id using .setClientId().');
    }
    if (authType !== 'code' && !redirectUri) {
      throw new Error('A redirect uri is required.');
    }
    if (!GrantTypes.includes(authType)) {
      throw new Error('Authorization type must be code or token');
    }
    if (tokenAccessType && !TokenAccessTypes.includes(tokenAccessType)) {
      throw new Error('Token Access Type must be legacy, offline, or online');
    }
    if (scope && !(scope instanceof Array)) {
      throw new Error('Scope must be an array of strings');
    }
    if (!IncludeGrantedScopes.includes(includeGrantedScopes)) {
      throw new Error('includeGrantedScopes must be none, user, or team');
    }

    let authUrl;
    if (authType === 'code') {
      authUrl = `${baseUrl}?response_type=code&client_id=${clientId}`;
    } else {
      authUrl = `${baseUrl}?response_type=token&client_id=${clientId}`;
    }

    if (redirectUri) {
      authUrl += `&redirect_uri=${redirectUri}`;
    }
    if (state) {
      authUrl += `&state=${state}`;
    }
    if (tokenAccessType) {
      authUrl += `&token_access_type=${tokenAccessType}`;
    }
    if (scope) {
      authUrl += `&scope=${scope.join(' ')}`;
    }
    if (includeGrantedScopes !== 'none') {
      authUrl += `&include_granted_scopes=${includeGrantedScopes}`;
    }
    if (usePKCE) {
      return this.generatePKCECodes()
        .then(() => {
          authUrl += '&code_challenge_method=S256';
          authUrl += `&code_challenge=${this.codeChallenge}`;
          return authUrl;
        });
    }
    return Promise.resolve(authUrl);
  }
Get a URL that can be used to authenticate users for the Dropbox API.
@arg {String} redirectUri - A URL to redirect the user to after
authenticating. This must be added to your app through the admin interface.
@arg {String} [state] - State that will be returned in the redirect URL to help
prevent cross site scripting attacks.
@arg {String} [authType] - auth type, defaults to 'token', other option is 'code'
@arg {String} [tokenAccessType] - type of token to request.  From the following:
null - creates a token with the app default (either legacy or online)
legacy - creates one long-lived token with no expiration
online - create one short-lived token with an expiration
offline - create one short-lived token with an expiration with a refresh token
@arg {Array<String>} [scope] - scopes to request for the grant
@arg {String} [includeGrantedScopes] - whether or not to include previously granted scopes.
From the following:
user - include user scopes in the grant
team - include team scopes in the grant
Note: if this user has never linked the app, include_granted_scopes must be None
@arg {boolean} [usePKCE] - Whether or not to use Sha256 based PKCE. PKCE should be only use
on client apps which doesn't call your server. It is less secure than non-PKCE flow but
can be used if you are unable to safely retrieve your app secret
@returns {Promise<String>} - Url to send user to for Dropbox API authentication
returned in a promise