SSO silent authentication PHP

Hi folks,

I am using Auth0 with SSO and it works fine for my SPAs. Recently I needed to add PHP application to have common SSO with other apps so I used https://github.com/auth0-samples/auth0-php-web-app/tree/master/00-Starter-Seed and it works well,

however if I authenticate in PHP app, my other apps pick up that login silently via SSO, but it does not work in another direction (if I login in my other apps, PHP still see this user as not logged in).

I believe this is because PHP demo app does not check remote session.

Could you please advise how I can add SSO login for PHP demo app?

Appreciate,
Ruslan

PS I am complete noob in PHP, please provide copy-paste code if possible. I also think it would be great to amend auth0 php demo to cover SSO login scenario.

@konrad.sopala could you help?

Hi @ruslan

I am sorry about the late reply to your inquiry!

SSO should work both ways regardless of application. As long as both application’s share the same database connection on the Auth0 Tenant, it should work by default.

Otherwise, if you do not check for the user’s session, now days, the SDK provides two functions for that:

  • getCredentials() - Returns an object representing the current session credentials (including id token, access token, access token expiration, refresh token and user data) without triggering an authorization flow. Returns null when session data is not available.
  • getAccessToken() - Get access token from an active session.

If you have any other questions, feel free to leavea. reply or post again on the community!

Kind Regards,
Nik