Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ancoka/larav-oauth2-client
This is an simple OAuth client service for Laravel framework.
https://github.com/ancoka/larav-oauth2-client
laravel laravel-package oauth2 oauth2-client
Last synced: 4 days ago
JSON representation
This is an simple OAuth client service for Laravel framework.
- Host: GitHub
- URL: https://github.com/ancoka/larav-oauth2-client
- Owner: ancoka
- License: mit
- Created: 2018-06-07T11:21:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-20T02:13:10.000Z (over 6 years ago)
- Last Synced: 2024-04-29T18:43:31.766Z (7 months ago)
- Topics: laravel, laravel-package, oauth2, oauth2-client
- Language: PHP
- Size: 16.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# larav-oauth2-client
larav oauth2 client 是一个针对 Laravel framework 实现的一个简单的 进行 OAuth 认证的扩展包。## 安装
1. 环境要求 ```PHP >= 5.6 ``` 并且 ```laravel >= 5.4```
2. 安装 larav oauth2 client,只需要添加下面内容到你的 composer.json 文件。然后执行 ```composer update```:
```
"ancoka/larav-oauth2-client": "1.0.*"
```或者直接执行:
```
composer require "ancoka/larav-oauth2-client:1.0.*"
```
3. 打开 ```config/app.php``` 文件添加下面内容到 ```providers``` 数组:
```
Ancoka\OAuth\OAuthServiceProvider::class,
```
4. 同样在 ```config/app.php``` 文件中添加下面内容到 ```aliases``` 数组:
```
'OAuth' => Ancoka\OAuth\Facades\OAuth::class,
```
5. 运行如下命令发布扩展包内配置文件 ```config/oauth_client.php```
```
php artisan vendor:publish --provider="Ancoka\OAuth\OAuthServiceProvider"
```
## 使用
#### 路由
生成 OAuth 认证路由,执行以下内容:
```
php artisan make:oauth
```会在 ```routes/web.php``` 文件中添加 ```OAuth::routes()``` 。
#### 中间件
你可以使用中间件拦截需要进行身份验证的所有路由,类似以下内容:
```
Route::middleware(['oauth.authorize'])->group(function () {
Route::get('/', 'IndexController@index')->name('home');
});
```## License
MIT