Ratings | | Unique User Downloads | | Download Rankings |
89% | | Total: 441 | | All time: 6,249 This week: 36 |
|
Collaborate with this project | | Author |
Description This package can implement a OAuth 2 based REST API server.
It implements a module on top of Lumen Laravel micro-framework to provide a REST API based on OAuth2 authorization.
The package also provides a users module with permission control that can create, update, delete and list users. | |
|
Recommendations
Example
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
$app->group(['namespace' => 'App\Http\Controllers'], function($group) use($app) {
$app->get('/admin/users', 'AdminUserController@index');
$app->post('/admin/users', 'AdminUserController@store');
$app->get('/admin/users/{users}', 'AdminUserController@show');
$app->patch('/admin/users/{users}', 'AdminUserController@update');
$app->delete('/admin/users/{users}', 'AdminUserController@destroy');
$app->get('/users', 'UserController@index');
$group->get('/', function () use ($app) {
return view()->make('client');
});
$group->post('login', function () use ($app) {
$username = app()->make('request')->input("email");
$password = app()->make('request')->input("password");
return $app->make('App\Auth\Proxy')->attemptLogin(["username" => $username, "password" => $password]);
});
$group->post('refresh-token', function () use ($app) {
return $app->make('App\Auth\Proxy')->attemptRefresh();
});
$group->post('oauth/access-token', function () use ($app) {
return response()->json($app->make('oauth2-server.authorizer')->issueAccessToken());
});
});
|
Details
Lumen Starter Pack
This package can implement a OAuth 2 based REST API server.
It implements a module on top of Lumen Laravel micro-framework to provide a REST API based on OAuth2 authorization.
The package also provides a users module with permission control that can create, update, delete and list users.
Installation
How To
Usage
Routes
-------------------------------------------------------------------------------------
POST => /login Required Params:email,password
POST => /refresh-token
-------------------------------------------------------------------------------------
Required Params : access_token
GET => /admin/users AdminUserController@index
POST => /admin/users AdminUserController@store
GET => /admin/users/{user_id} AdminUserController@show
PATCH => /admin/users/{user_id} AdminUserController@update
DELETE => /admin/users/{user_id} AdminUserController@destroy
-------------------------------------------------------------------------------------
GET => /users Required params: access_token | UserController@index
-------------------------------------------------------------------------------------
*Look inside to Unit tests to understand more*
Users Table Schema
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password', 60);
$table->boolean('is_admin',0);
$table->rememberToken();
$table->timestamps();
});
User Login Informations
user@user.com
user1234
Resources
LUMEN
LUMEN API OAUTH
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.