Invalid State Error after Upgrading from Auth0 PHP SDK v7 to v8

Hi @yrmallu

Thanks for those additional details. Things look OK there.

Could you please run the following from your project’s root directory and share the resulting output here?

composer show

I’m wondering if that session_start() call is potentially messing with the cookie writing. I’d recommend removing that unless it’s absolutely necessary. Otherwise, you might need to use the SessionStore for session and transient storage with the SDK, as opposed to the default CookieStore.

<?php
use Auth0\SDK\Auth0;
use Auth0\SDK\Configuration\SdkConfiguration;
use Auth0\SDK\Store\SessionStore;

$configuration = new SdkConfiguration(
    domain: $domain,
    clientId: $client_id,
    clientSecret: $client_secret,
    cookieSecret: $secret,
);

$sessionStorage = new SessionStore($configuration, $configuration->getSessionStorageId());
$transientStorage = new SessionStore($configuration, $this->getTransientStorageId());

$configuration->setSessionStorage($sessionStorage);
$configuration->setTransientStorage($transientStorage);

$auth0 = new Auth0($configuration);

(SessionStore internally sets up the session using session_start() on it’s own, so you won’t need to make that call yourself if you use it, unless you need session access prior to initializing the SDK.)