phalcon/cphalcon · error · InvalidAudienceType

Audience must be a string or an array

Error message

Audience must be a string or an array

What it means

Error "Audience must be a string or an array" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Encryption/Security/JWT/Validator.zep:172

        }

        return this;
    }

    /**
     * Validate the audience
     *
     * @param string|array $audience
     *
     * @return static
     * @throws ValidatorException
     */
    public function validateAudience(var audience) -> <static>
    {
        var item, tokenAudience;

        if (typeof audience !== "string" && typeof audience !== "array") {
            throw new InvalidAudienceType();
        }

        if (typeof audience === "string") {
            let audience = [audience];
        }

        let tokenAudience = this->token->getClaims()->get(Enum::AUDIENCE, []);

        for item in audience {
            if (true !== in_array(item, tokenAudience)) {
                let this->errors[] = "Validation: audience not allowed";
            }
        }

        return this;
    }

    /**

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Encryption/Security/JWT/Validator.zep:172 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/21ecb45442d98683. Report an issue: GitHub.