1

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

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require './vendor/autoload.php';

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

session_id('test');
session_start();

/** 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(
    $requestToken->getRequestToken(),
    $oauthVerifier,
    $requestToken->getRequestTokenSecret()
);

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

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.