指导我在 phpleague 库中实现 OAuth2 存储类 [英] Guide me implementing OAuth2 storage classes in thephpleague library

查看:71
本文介绍了指导我在 phpleague 库中实现 OAuth2 存储类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Alex Bilbie 提供的 phpleague 库开发 oAuth 2.0 服务器.但是,在初始化授权服务器后,当我声明存储类时,它会引发以下错误.

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.

致命错误:找不到Storage\SessionStorage"类"

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

请帮我解决这个问题.我在这里阅读了您关于此问题的帖子:- 指导我使用 phpleague 库实现 Oauth2 PHP 服务器

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); 

推荐答案

您使用的库需要实现您自己的存储类,请参阅 http://oauth2.thephpleague.com/implementing-storage-interfaces/.您使用的类名来自示例实现 https://github.com/thephpleague/oauth2-server/tree/master/examples/relational/Storage 使用 Capsule 作为其存储后端.如果你想使用 Capsule 作为你的后端,你需要下载这些示例实现类并安装 https://github.com/illuminate/database.

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.

这篇关于指导我在 phpleague 库中实现 OAuth2 存储类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆