chalasr/lexik-jwt-authentication-sandbox

LexikJWTAuthenticationBundle Symfony 扩展包的沙盒

资助包维护!
chalasr

安装: 203

依赖: 0

建议者: 0

安全: 0

星标: 80

关注者: 8

分支: 37

开放问题: 3

类型:项目

v1.0.0 2016-11-01 10:36 UTC

README

这是一个用于实验/演示 LexikJWTAuthenticationBundle 扩展包强大功能的示例应用程序,该扩展包通过 JWT 提供身份验证。

包含内容

开始使用

克隆项目

$ git clone https://github.com/chalasr/lexik-jwt-authentication-sandbox
$ cd lexik-jwt-authentication-sandbox
$ git checkout flex

创建数据库模式

$ php bin/console doctrine:database:create
$ php bin/console doctrine:schema:update --force

用法

运行 web 服务器

$ php bin/console server:run

注册新用户

$ curl -X POST http://localhost:8000/register -d _username=johndoe -d _password=test
-> User johndoe successfully created

获取 JWT 令牌

$ curl -X POST -H "Content-Type: application/json" http://localhost:8000/login_check -d '{"username":"johndoe","password":"test"}'
-> { "token": "[TOKEN]" }  

访问受保护的路由

$ curl -H "Authorization: Bearer [TOKEN]" http://localhost:8000/api
-> Logged in as johndoe