mercredi 2 août 2017

Single Sign On with subdomains on the same server

How I can implement single sign-on with two subdomains?

  • app1.domain.com
  • app2.domain.com

I already created the virtual host with apache on my local machine, so i have two larevel projects: app1.domain.com and app2.domain.com

I would like that when I log in to a subdomain the other subdomain should be logged with the same session

I tried to configure the .env file and config/session.php:

  • app1

.env

APP_KEY=base64:qs1+/YjtqEPjS3HUYC/PaDDQk51gWY0H4iw6eAG0RF8=

APP_URL=http://app1.domain.com/

SESSION_DOMAIN=.domain.com

config/session.php

'driver' => env('SESSION_DRIVER', 'file'),

'domain' => env('SESSION_DOMAIN', '.domain.com'),

  • app2

.env

APP_KEY=base64:qs1+/YjtqEPjS3HUYC/PaDDQk51gWY0H4iw6eAG0RF8=

APP_URL=http://app2.domain.com/

SESSION_DOMAIN=.domain.com

config/session.php

'driver' => env('SESSION_DRIVER', 'file'),

'domain' => env('SESSION_DOMAIN', '.domain.com'),

This doesnt work, when one subdomain is logged the other is not logged in, How can i implement a SSO with laravel, if there any package for laravel 5.4?

I would appreciate your help, I've been stuck with this for days.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire