1

I am developing an oAuth 2.0 server using thephpleague library provided by Alex Bilbie. But, after the initializing the authorization server, when I declare the storage classes it throws an following error.

"Fatal error: Class 'Storage\SessionStorage' not found"

Please help me to resolve this. I read your post about this problem here:- Guide me implementing Oauth2 PHP server using thephpleague library

Please let me know how can I implement the storage classes. My current code:

require_once "/../vendor/autoload.php";
$server = new \League\OAuth2\Server\AuthorizationServer;
$server->setSessionStorage(new Storage\SessionStorage);
$server->setAccessTokenStorage(new Storage\AccessTokenStorage);
$server->setClientStorage(new Storage\ClientStorage);
$server->setScopeStorage(new Storage\ScopeStorage);
$server->setAuthCodeStorage(new Storage\AuthCodeStorage);
$authCodeGrant = new \League\OAuth2\Server\Grant\AuthCodeGrant();
$server->addGrantType($authCodeGrant); 
John Slegers
  • 45,213
  • 22
  • 199
  • 169
Sudhir Vadodariya
  • 391
  • 1
  • 2
  • 11
  • What does your code look like? – Hans Z. Feb 02 '15 at 07:03
  • I installed the library using composer and here is command:- "composer require league/oauth2-server". Here is the path structure:- D:\wamp\www\demos\oAuth\oAuth2\vendor\league\oauth2-server\src\ "ALL LIBRARY CLASSES" And Auload.php file path is:- D:\wamp\www\demos\oAuth\oAuth2\vendor\autoload.php – Sudhir Vadodariya Feb 02 '15 at 07:12

1 Answers1

1

The library that you use requires implementing your own storage classes, see http://oauth2.thephpleague.com/implementing-storage-interfaces/. The class names that you use are from an example implementation https://github.com/thephpleague/oauth2-server/tree/master/examples/relational/Storage that uses Capsule as its storage backend. If you want to use Capsule as you backend, you'll need to download those example implementation classes and install https://github.com/illuminate/database.

Hans Z.
  • 50,496
  • 12
  • 102
  • 115
  • Sorry Hanz but i didn't get your answer. I put the Storage folder from https://github.com/thephpleague/oauth2-server/tree/master/examples/relational/Storage to my local directory but it still throw an error. and Also, i tried to run the relational example. But, unfortunately it also throw this error. – Sudhir Vadodariya Feb 02 '15 at 07:56
  • they need to be in a `Storage` directory – Hans Z. Feb 02 '15 at 07:59
  • Yes, here is my storage directory path:- D:\wamp\www\demos\oAuth\oAuth2\Storage\ ALL STORAGE CLASS – Sudhir Vadodariya Feb 02 '15 at 08:03