Accessing Auth0 PHP SDK across different scripts

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.

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.

1 Like

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