Cookies after login are not received by my web

Hello, can you advice me why cookies are not sent to my web page after login. I can see some cookies like auth0_compt and auth0 during autentification via auth0 login form but it is just on auth0 pages like /authorize and /resume.

Thank you

Hey there @pb2023 !

As a first step of the investigation I think you may want to learn about the cross-domians cookies storage restrictions in your browser policy. Thanks!

Thank you, I have allowed all cookies now, but I have still the same problem. I will be very helpful for any other suggestions.

And how can user uses auth0 login if has blocked 3rd party cookies?

Thanks for following up!

Can you maybe share some context in which you use Auth0?

In general, Auth0 SDKs that support recommended for the specific app types login flows are here to do it for you.
If you would like to see the solutions provided by Auth0 in action, you can set up a sample app, for example - GitHub - auth0-samples/auth0-javascript-samples: Auth0 Integration Samples for Vanilla JavaScript Applications to see the authentication process in your browser.

There is also a cookies section in our docs that you may find helpful - Cookies


:video_camera: Prefer how-to videos instead of written docs? We’ve got you covered! Check out our OktaDev YouTube channel for those helpful resources!
—----------------------------------------------------------------------------------------------------------------------------

I set up auth0 according to steps from this quickstart Auth0 PHP SDK Quickstarts: Add Login to your PHP application

And now I am using this code to check if user is authenticated, but it is still false.

	// Check if user is not authenticated
	if (!$sdk->isAuthenticated()) {

	    // Redirect user to Auth0 login page
		$loginUrl = $sdk->login();
		header("Location: $loginUrl");
		exit;
	}

And it is not bad idea, I will download sample and try to check the flow. Thanks

Sure thing!

Very often issues encountered with our quickstarts can be narrowed down to a wrong configuration between the client app and Auth0.

In terms of your code snippet:
If the condition to send the user to the login page amounts to false, it can be that there is already a [valid session] for a user (https://auth0.com/docs/authenticate/login/logout) →

Hope this helped! Please let me know in case you have questions at some point!


:video_camera: Want to join our next Community Interactive Q&A with our experts? This time we’re gonna talk about Auth0 Terraform Provider

Thanks, but I think logout is not problem bcz when I use logout.php page and then login.php then I am redirected to auth0 login page. If I am not logged out then it will not show auth0 login web page and it will redirect me to page which I have set up and should be showed after successfull login…

Hi and thanks for following up!
Did you manage to set up your php sample?

And now I am using this code to check if user is authenticated, but it is still false.

Do you mean that after a user successfully authenticate against Auth0, the condition resolve to false?
Taking into account the exclamation sign before the “$sdk” variable: (if (!$sdk->isAuthenticated()) {…}; , it would be an expected behaviour (the negation of true resolving to false).


:video_camera: Want to join our next Community Interactive Q&A with our experts? This time we’re gonna talk about Auth0 Terraform Provider

1 Like

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