private function setAuthenticationParameters(
        $keys = null,
        $params = null,
        $type = 'req'
    ) {
        if (!empty($keys['auth'][$type])) {
            if ($this->auth == null) {
                $msg = 'No Auth object provided.  (HINT: Set your Auth data using '
                     . '"$API->setAuth(Auth $auth)" or $API\' constructor.  '
                     . 'See https://TODO for details.';
                throw new ApiAuthenticationException($msg);
            }

            // Set authentication parameters
            $auth_group = false;
            foreach ($keys['auth'][$type] as $k) {
                if (is_array($k) && !empty($k)) {
                    /*
                     * Different auth key groups may be required.
                     * In these situations, must assert that each
                     * key within an auth key group exists. Exits
                     * once the first auth key group is validated.
                     */

                    if ($auth_group && $auth_group_validated) {
                        /*
                        * At this point an authentication group has been satisfied
                        * and we don't need to process additional groups.
                        */
                        continue;
                    }

                    $auth_group = true;
                    $auth_group_validated = true;
                    foreach ($k as $g) {
                        if (!isset($params[$g])) {
                            $v = $this->auth->getAuthKeyVar($g);
                            if (!$v) {
                                $auth_group_validated = false;
                                break;
                            }
                            $params[$g] = $v;
                        }
                    }
                } else {
                    if (!isset($params[$k])) {
                        $v = $this->auth->getAuthKeyVar($k);
                        if (!$v) {
                            if ($type == 'req') {
                                $msg = 'Authentication key `'.$k.'` is required. '
                                     . 'HINT: Set your Auth data using "$API->'
                                     . 'setAuth(Auth $auth)" or $API\' constructor. '
                                     . 'See https://TODO for details.';
                                throw new ApiAuthenticationException($msg);
                            } else {
                                // optional
                                continue;
                            }
                        }
                        $params[$k] = $v;
                    }
                }
            }

            // If keys configured with authentication groups, verify one was validated
            if ($auth_group && !$auth_group_validated) {
                $msg = 'A required authentication key group was not satisfied. '
                     . '(HINT: Reference the $keys '
                     . 'property at the top of the API class file for '
                     . 'required and optional parameters.)';
                throw new ApiAuthenticationException($msg);
            }
        }

        return $params;
    }