# Accessing Auth0 PHP SDK across different scripts

**URL:** <https://community.auth0.com/t/accessing-auth0-php-sdk-across-different-scripts/119762>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, auth0-php\
**Created:** [October 30, 2023, 7:24pm UTC](https://community.auth0.com/t/accessing-auth0-php-sdk-across-different-scripts/119762 "2023-10-30T19:24:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![admin71](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/admin71/32/52072_2.png) [@admin71](https://community.auth0.com/u/admin71)\
**Post date:** [October 30, 2023, 7:24pm UTC](https://community.auth0.com/t/accessing-auth0-php-sdk-across-different-scripts/119762/1 "2023-10-30T19:24:48Z")

</div>

Hi there,

Is there a way to pull from the auth0 SDK across different PHP scripts on the same webserver? Everything I’m seeing requires you to create a new Auth0 object at the beginning of the script, which you can only do in one place. We’re building on a legacy system that previously did auth checks by including a function to do those checks, but the quickstart guides you through building a PHP router for the authentication flow (which we did fine), I’d like to create another auth function when a user attempts to access restricted areas, but from what I can tell this would need to somehow be integrated into the same script that does user facing auth, otherwise we would need to do a client request to an auth endpoint, and we obviously can’t rely on that going through.

The user needs to go through our auth flow, to make sure the session isn’t expired, etc, before accessing resources, and it needs to be server enforced with server-side checks before it gives access to those resources, and I’m not sure how I can do that with this SDK.

---

<div class="post-metadata">

**Author:** ![admin71](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/admin71/32/52072_2.png) [@admin71](https://community.auth0.com/u/admin71)\
**Post date:** [October 30, 2023, 7:31pm UTC](https://community.auth0.com/t/accessing-auth0-php-sdk-across-different-scripts/119762/2 "2023-10-30T19:31:26Z")

</div>

Looks like this was my bad entirely. I hadn’t included the environment variables library from composer, so it just wasn’t authenticating. My bad. Appears to work fine now.

---

<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 13, 2023, 7:31pm UTC](https://community.auth0.com/t/accessing-auth0-php-sdk-across-different-scripts/119762/3 "2023-11-13T19:31:56Z")

</div>

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