通过passport创建令牌的事件AccessTokenCreated得到生成的token,如何在该事件中根据生成的token_id转换成相应的access_token?
1 回答
神不在的星期二
TA贡献1963条经验 获得超6个赞
翻找源码,按照他的格式重新写了一下,不是特别优雅
<?phpnamespace App\Listeners;use Carbon\Carbon;use Illuminate\Support\Facades\Config;use Illuminate\Support\Facades\DB;use Illuminate\Support\Facades\Redis;use Laravel\Passport\Bridge\AccessToken;use Laravel\Passport\Bridge\AccessTokenRepository;use Laravel\Passport\Bridge\AuthCodeRepository;use Laravel\Passport\Bridge\ClientRepository;use Laravel\Passport\Bridge\Scope;use Laravel\Passport\Events\AccessTokenCreated;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Contracts\Queue\ShouldQueue;use Laravel\Passport\Passport;use Laravel\Passport\Token;use League\OAuth2\Server\AuthorizationServer;use League\OAuth2\Server\CryptKey;use League\OAuth2\Server\Entities\ScopeEntityInterface;use League\OAuth2\Server\Entities\Traits\AccessTokenTrait;use League\OAuth2\Server\Entities\Traits\EntityTrait;use League\OAuth2\Server\Entities\Traits\TokenEntityTrait;use League\OAuth2\Server\Exception\OAuthServerException;
- 1 回答
- 0 关注
- 1336 浏览
添加回答
举报
0/150
提交
取消