# (Programmatically) bypass the auth0 authentication

**URL:** <https://community.auth0.com/t/programmatically-bypass-the-auth0-authentication/70500>\
**Category:** Get Help\
**Tags:** auth0-php, laravel, php\
**Created:** [September 29, 2021, 3:06pm UTC](https://community.auth0.com/t/programmatically-bypass-the-auth0-authentication/70500 "2021-09-29T15:06:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![handikadwi7](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/handikadwi7/32/13039_2.png) [@handikadwi7](https://community.auth0.com/u/handikadwi7)\
**Post date:** [September 29, 2021, 3:06pm UTC](https://community.auth0.com/t/programmatically-bypass-the-auth0-authentication/70500/1 "2021-09-29T15:06:37Z")

</div>

so here’s the thing  
I have two apps  
there is login button in the first app. If the button is clicked, the user will be automatically logged in to the second app  
and if the user logs himself out from the second app, he will be redirected to Auth0 authentication

the problem I’m having now is when a user clicks the login button from the first app, he will be redirected to Auth0 authentication. This is not expected. He should be automatically logged in to the second app  
I can’t find a way to automatically log him in on the PHP (Laravel) SDK

How do I do it?  
Btw, the first app and the second app use PHP. (Wordpress and Laravel-with Auth0 integrated, respectively)

---

<div class="post-metadata">

**Author:** ![Ale](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ale/32/50860_2.png) [@Ale](https://community.auth0.com/u/Ale)\
**Post date:** [October 9, 2021, 12:44am UTC](https://community.auth0.com/t/programmatically-bypass-the-auth0-authentication/70500/2 "2021-10-09T00:44:48Z")

</div>

Hey @handikadwi7 ,

So, if I’ve understood correctly, the flow you’ve tested and described is:

1. The user logins via first app. A consequence of this is that the user is logged in to the second app too. → This is expected due to our seamless SSO between applications that are integrated in the same Auth0 tenant and have the same database enabled.

2. The user logs out from the second app, being redirected to your Auth0 login page. → Please note, if you’ve used our `/logout` endpoint, then the user will be logged out from your Auth0 tenant - from all applications. You might want to read [Logout](https://auth0.com/docs/login/logout) to fully understand this.

3. The user now goes and clicks on the login button from the first app, being redirected to your Auth0 login page. → This is actually expected, since the user logged out in the previous step. When logging out from the second application, the SSO Cookie was cleared and hence the user was logged out from all applications (Auth0 Session layer)

In conclusion, if I’ve understood your flow correctly (sorry if not), everything is working as expected. You might want to read the logout documentation I mentioned in step #2 or even better, [Session Layers](https://auth0.com/docs/users/sessions/session-layers) to fully understand how sessions work.

Regarding your question:

> [@handikadwi7](#):
>
> I can’t find a way to automatically log him in on the PHP (Laravel) SDK

The reason why the user was not logged in automatically when calling the `/authorize` endpoint is because there was no active Auth0 session anymore.

---

<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:** [October 27, 2021, 5:32am UTC](https://community.auth0.com/t/programmatically-bypass-the-auth0-authentication/70500/3 "2021-10-27T05:32:25Z")

</div>

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