Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glocurrency/api-layer
Basic API layer.
https://github.com/glocurrency/api-layer
passport
Last synced: about 2 months ago
JSON representation
Basic API layer.
- Host: GitHub
- URL: https://github.com/glocurrency/api-layer
- Owner: glocurrency
- License: mit
- Archived: true
- Created: 2020-06-17T12:46:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-14T05:42:06.000Z (over 4 years ago)
- Last Synced: 2023-08-21T10:56:09.271Z (about 1 year ago)
- Topics: passport
- Language: PHP
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Api Layer
## Installation
```
composer require glocurrency/api-layer
```### Passport
This module use Laravel Passport heavily. In order to make it work properly, follow the steps:
1. Run
```
php artisan glo:apilayer:passport
```This command will:
- generate the keys
- copy the migrations from passport
- replace both `client_id` and `user_id` columns in migrations with UUID.2. Copy the passport middlewares to the `$routeMiddleware` in your `app/Http/Kernel.php` file:
```php
'client' => \Laravel\Passport\Http\Middleware\CheckClientCredentials::class,
'scopes' => \Laravel\Passport\Http\Middleware\CheckScopes::class,
'scope' => \Laravel\Passport\Http\Middleware\CheckForAnyScope::class,
```3. Add the following code to the `boot` method of `AuthServiceProvider`:
```php
use Glocurrency\ApiLayer\ApiLayer;public function boot()
{
$this->registerPolicies();ApiLayer::passport();
}
```4. Generate both Client and Personal grant tokens.
```
php artisan passport:client --client
php artisan passport:client --personal
```After creating your personal access client, place the client's ID and plain-text secret value in your application's `.env` file:
```ini
PASSPORT_PERSONAL_ACCESS_CLIENT_ID=client-id-value
PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET=unhashed-client-secret-value
```5. Use `UnauthenticatedTrait` in your `app/Exceptions/Handler.php` file:
```php
use Glocurrency\ApiLayer\Traits\UnauthenticatedTrait;class Handler extends ExceptionHandler
{
use UnauthenticatedTrait;
```## License
Glocurrency Api Layer is open-sourced software licensed under the [MIT license](LICENSE).
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fglocurrency%2Fapi-layer.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fglocurrency%2Fapi-layer?ref=badge_large)