【发布时间】:2015-04-01 02:04:27
【问题描述】:
我正在使用 Alex Bilbie 提供的 phpleague 库开发一个 oAuth 2.0 服务器。但是,在初始化授权服务器之后,当我声明存储类时,它会引发以下错误。
“致命错误:找不到类 'Storage\SessionStorage'”
请帮我解决这个问题。我在这里阅读了您关于此问题的帖子:- Guide me implementing Oauth2 PHP server using thephpleague library
请告诉我如何实现存储类。我当前的代码:
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);
【问题讨论】:
-
你的代码是什么样的?
-
我使用 composer 安装了库,这里是命令:-“composer 需要联盟/oauth2-server”。这里是路径结构:- D:\wamp\www\demos\oAuth\oAuth2\vendor\league\oauth2-server\src\ "ALL LIBRARY CLASSES" 和 Auload.php 文件路径是:- D:\wamp\www \demos\oAuth\oAuth2\vendor\autoload.php
标签: php oauth-2.0 thephpleague