hi i am trying to create OAuth-based authentication by following official doc https://devdocs.magento.com/guides/v2.3/get-started/authentication/gs-authentication-oauth.html

but when i click on login i am getting this below issue

ini_set('display_errors', 1);
require './vendor/autoload.php';

$consumerKey = $_REQUEST['oauth_consumer_key'];
$callback = $_REQUEST['callback_url'];


/** Use $consumerKey to retrieve the following data in case it was stored in DB when received at "endpoint.php" */
if ($consumerKey !== $_SESSION['oauth_consumer_key']) {
    throw new \Exception("Consumer keys received on different requests do not match.");

$consumerSecret = $_SESSION['oauth_consumer_secret'];
$magentoBaseUrl = rtrim($_SESSION['store_base_url'], '/');
$oauthVerifier = $_SESSION['oauth_verifier'];

define('TESTS_BASE_URL', $magentoBaseUrl);

$credentials = new \OAuth\Common\Consumer\Credentials($consumerKey, $consumerSecret, $magentoBaseUrl);
$oAuthClient = new OauthClient($credentials);
$requestToken = $oAuthClient->requestRequestToken();
$accessToken = $oAuthClient->requestAccessToken(

header("location: $callback");

and this is the error avaialbe in reporting

Warning: require(./vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/localdev/pramod/pub/checklogin.php on line 4

Fatal error: require(): Failed opening required './vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/html/localdev/pramod/pub/checklogin.php on line 4

or does anyone have any other documentation or can guide me on this issue

1 Answer 1


You are using wrong path for ./vendor/autoload.php

Replace this code require './vendor/autoload.php';

With: require '../vendor/autoload.php';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.