# Really stuck on instantiating the Auth0 PHP SDK

**URL:** <https://community.auth0.com/t/really-stuck-on-instantiating-the-auth0-php-sdk/94582>\
**Category:** JWT.io\
**Tags:** sdk, api, php, auth0\
**Created:** [November 16, 2022, 11:29pm UTC](https://community.auth0.com/t/really-stuck-on-instantiating-the-auth0-php-sdk/94582 "2022-11-16T23:29:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![acalpixca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/acalpixca/32/39774_2.png) [@acalpixca](https://community.auth0.com/u/acalpixca)\
**Post date:** [November 16, 2022, 11:29pm UTC](https://community.auth0.com/t/really-stuck-on-instantiating-the-auth0-php-sdk/94582/1 "2022-11-16T23:29:00Z")

</div>

Hi, just going crazy following this tutorial.

[https://auth0.com/docs/quickstart/backend/php/01-authorization#integrating-your-php-backend-api](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…

```auto
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!!!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 24, 2022, 11:48am UTC](https://community.auth0.com/t/really-stuck-on-instantiating-the-auth0-php-sdk/94582/2 "2022-11-24T11:48:58Z")

</div>

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?

> **[Issues · auth0-samples/auth0-php-api-samples](https://github.com/auth0-samples/auth0-php-api-samples/issues)**
>
> Auth0 Integration Samples for PHP REST API Services - Issues · auth0-samples/auth0-php-api-samples

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

---

<div class="post-metadata">

**Author:** ![h4bufoo](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@h4bufoo](https://community.auth0.com/u/h4bufoo)\
**Post date:** [March 26, 2023, 12:15pm UTC](https://community.auth0.com/t/really-stuck-on-instantiating-the-auth0-php-sdk/94582/3 "2023-03-26T12:15:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [March 27, 2023, 7:05am UTC](https://community.auth0.com/t/really-stuck-on-instantiating-the-auth0-php-sdk/94582/4 "2023-03-27T07:05:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![evansims](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/evansims/32/27011_2.png) [@evansims](https://community.auth0.com/u/evansims)\
**Post date:** [June 8, 2023, 4:50am UTC](https://community.auth0.com/t/really-stuck-on-instantiating-the-auth0-php-sdk/94582/5 "2023-06-08T04:50:42Z")

</div>

👋 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](https://github.com/auth0/auth0-PHP/blob/main/src/Configuration/SdkConfiguration.php#L72)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 14, 2024, 10:59pm UTC](https://community.auth0.com/t/really-stuck-on-instantiating-the-auth0-php-sdk/94582/6 "2024-11-14T22:59:18Z")

</div>

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