Problem with installation of auth0

Hello, I tried to install auth0 but I get error:

**Fatal error**: Uncaught InvalidArgumentException: Could not find a PSR-18 compatible HTTP client. Please install one, or provide one using the `setHttpClient()` method. in /var/www/clients/client1432/web5236/web/_inc/vendor/auth0/auth0-php/src/Utility/Assert.php:7137 Stack trace: #0 /var/www/clients/client1432/web5236/web/_inc/vendor/auth0/auth0-php/src/Utility/Assert.php(4352): Auth0\SDK\Utility\Assert::reportInvalidArgument() #1 /var/www/clients/client1432/web5236/web/_inc/vendor/auth0/auth0-php/src/Configuration/SdkConfiguration.php(1459): Auth0\SDK\Utility\Assert::isInstanceOf() #2 /var/www/clients/client1432/web5236/web/_inc/vendor/auth0/auth0-php/src/Configuration/SdkConfiguration.php(167): Auth0\SDK\Configuration\SdkConfiguration->setupStateFactories() #3 /var/www/clients/client1432/web5236/web/bazar/index.php(19): Auth0\SDK\Configuration\SdkConfiguration->__construct() #4 {main} thrown in **/var/www/clients/client1432/web5236/web/_inc/vendor/auth0/auth0-php/src/Utility/Assert.php** on line **7137**

My code in index.php is:

<?php

	declare(strict_types=1);

	// include header
	require($_SERVER['DOCUMENT_ROOT'] . '/bazar/_partials/header.php');

	// Get data for main page
	$all_cat_subcat = getAllCatAndSubcat();
	use Symfony\Component\HttpClient\HttpClient;
	use Auth0\SDK\Auth0;
	use Auth0\SDK\Configuration\SdkConfiguration;

	$configuration = new SdkConfiguration(
		domain: '...',
		clientId: '...',
		clientSecret: '...',
		redirectUri: 'http://' . $_SERVER['HTTP_HOST'] . '/callback',
		cookieSecret: '...'
	);

	$sdk = new Auth0($configuration);

	require('router.php');

?>

Can you help me what to do? Thank you

This I have installed via composer:

Package operations: 3 installs, 0 updates, 0 removals

  • Installing symfony/service-contracts (v3.0.2): Extracting archive
  • Installing symfony/http-client-contracts (v3.0.2): Extracting archive
  • Installing symfony/http-client (v6.0.20): Extracting archive

Hey there!

Can you share the link from our Auth0 docs / quickstarts / SDKs that you were following in that implementation? Thank you!

Hello, here it is: Auth0 PHP SDK Quickstarts: Add Login to your PHP application

Perfect! I’ll ping the repo maintainers in a few minutes!

Sorry, finally I found that not all files were upload to server. Now it is working, but I have other problems. :slight_smile:

1 Like

No problem glad you sorted that part out! Feel free to open a separate topic for the problems you face now. Thanks!

1 Like

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