Really stuck on instantiating the Auth0 PHP SDK

Hi, just going crazy following this tutorial.

https://auth0.com/docs/quickstart/backend/php/01-authorization#integrating-your-php-backend-api

To cut a long story short, instantiating the SDK is not working for me. It throws an error 500. So I wrapped the statement in a try… catch, like this, to see what the error was…

try {
    $auth0 = new \Auth0\SDK\Auth0([
    'domain' => $_ENV['AUTH0_DOMAIN'],
    'clientId' => $_ENV['AUTH0_CLIENT_ID'],
    'clientSecret' => $_ENV['AUTH0_CLIENT_SECRET'],
    'audience' => $_ENV['AUTH0_AUDIENCE']
]);
} catch (Exception $e) {
    exit($e->getMessage());
}

it turns out that the audience parameter is not correct, all other parameters are correct. This is the error message that I captured.

Validation of “audience” was unsuccessful

I’ve been careful to populate the .env file with the information provided in the Auth0 configuration screens correctly. The audience should be the easiest of all, it even appears in your API list, with the copy button & all!

Anybody else has encountered this problem?

All I need is for my PHP code to validate that the Bearer token that it receives in the http request header is a good one. But can’t get past the first step using the Auth0 SDK.

Any help will be appreciated!!!

Hey there!

In order to handle that most effectively can I ask you to raise it as a GitHub issue in the repo so we can work on that directly with the quickstart maintainers?

Once you have a link, can you share it here so we can ping them. Thank you!

I’m facing the exact same issue.
There is no GitHub issue on this.
Have you already resolved this?

If there’s not can you raise it yourself and share the link to it here? Thank you!

:wave: You’re attempting to pass a string for the audience. However, this property must be configured as an array: auth0-PHP/SdkConfiguration.php at main · auth0/auth0-PHP · GitHub

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.