# How to create an Auth0 sessions programmatically (PHP SDK)

**URL:** <https://community.auth0.com/t/how-to-create-an-auth0-sessions-programmatically-php-sdk/135240>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, auth0-php\
**Created:** [May 29, 2024, 9:18pm UTC](https://community.auth0.com/t/how-to-create-an-auth0-sessions-programmatically-php-sdk/135240 "2024-05-29T21:18:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devans](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@devans](https://community.auth0.com/u/devans)\
**Post date:** [May 29, 2024, 9:18pm UTC](https://community.auth0.com/t/how-to-create-an-auth0-sessions-programmatically-php-sdk/135240/1 "2024-05-29T21:18:31Z")

</div>

My team is attempting to authenticate and create Auth0 sessions for users we have already authenticated via the Management API. Once we retrieve the user’s access\_token and id\_token, we are looking to verify and then sign those users into our WordPress sites via the PHP SDK.

So far we have been able to verify and validate the tokens received from the Management API but we haven’t found any information regarding using the SDK to actually sign-in the user programmatically on the backend. Is this possible to achieve?

Background:

- We set users up with a device for which we create a new account for.
- We automatically retrieve the user’s access\_token and id\_token from the Management API and pass those values to the device
- We then set a cookie on the device’s web browser which is validated
- We then want to automatically log the user into the site using the SDK so that SSO works across all the sites we have setup with the Auth0 WordPress plugin

---

<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 3, 2024, 2:16am UTC](https://community.auth0.com/t/how-to-create-an-auth0-sessions-programmatically-php-sdk/135240/2 "2024-06-03T02:16:38Z")

</div>

Hi @devans

It’s not possible to authenticate a user from the backend from the SDK. The SDK only supports users following through with the authentication flow, and directly sets up the end-user device with the necessary session/cookies. We don’t presently support any approach to doing this in a non-interactive manner.

The WordPress plugin also ties its authentication state to a native WordPress auth/session. It does not presently support setting the auth state up in a non-interactive manner that would support this.

You would need to write an entirely custom approach for this, and it would require reverse engineering the processes used by both the SDK and the plugin, and spinning it into your own library/plugin. I can’t guarentee that it would work, and this isn’t something we can provide support with. Sorry, I can’t provide a straightforward solution.

---

<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:** [June 17, 2024, 2:16am UTC](https://community.auth0.com/t/how-to-create-an-auth0-sessions-programmatically-php-sdk/135240/3 "2024-06-17T02:16:49Z")

</div>

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