joselfonseca / laravel-api Goto Github PK
View Code? Open in Web Editor NEWLaravel API starter Kit will provide you with the tools for making API's that everyone will love
License: MIT License
Laravel API starter Kit will provide you with the tools for making API's that everyone will love
License: MIT License
Is this any option with pagination and filter while taking list user. It will help if your project has this funtion. Thanks
Can you add facebook connect/signup
route: user/facebook
User does not have the right permissions. error showing
"message": "User does not have the right permissions.",
"status_code": 403,
"debug": {
"line": 37,
Hello there! Make sure you include this checklist in the PR
PATCH and PUT endpoints to update the logged in user information
How to update assets file?
Hello, download and install the repository step by step and did not work the calls oauth2 of passport. The tests I did with postman tool
regards.
I am going to use this as a back-end of a spa (front-end will be react).
so I need to login, registration forget password and reset password script.
any good idea?
In Connection.php line 664:
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. (SQL: insert into oauth_clients
(user_id
, name
, secret
, redirect
, personal_access_client
, password_client
, revok ed
, updated_at
, created_at
) values (, Laravel API Personal Access Client, nBN4Cssau7Xbbe6bDJVbqpN50LrooVB9OdHWB8dn, http://localhost, 1, 0, 0, 2018-08-24 11:15:44, 2018-08-24 11:15:44))
In Connector.php line 68:
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known.
In Connector.php line 68:
PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No such host is known.
Need to update the starter kit to Laravel 5.5
In order to make it work in a completely new project I had to change
in package.json
:
node_modules/cross-env/bin/cross-env.js
To -> node_modules/cross-env/dist/bin/cross-env.js
and update laravel-mix package using "laravel-mix": "0.*",
just to let you know and check if it was a global issue or just mine
@joselfonseca what do you think about adding a unique index on uuid
columns in database tables migrations ?
When try to Php artisan app:install
unable to figure it out the problem
PHP Parse error: parse error, expecting ';'' or
'{'' in /Library/WebServer/Documents/new-api/app/Services/Users/UsersService.php on line 76
[Symfony\Component\Debug\Exception\FatalErrorException]
parse error, expecting ';'' or
'{''
In the "index" methods of controllers, i see that the limit
query parameter is handled to modify the default pagination. But i see that the appends()
paginator method is not used to pass at least the limit
parameter so it is missing in the generated link in response pagination metadata.
Maybe add something like ->appends($request->only('limit'))
(and let developer decide if it allow more ? dunno if $request->all()
may be a security issue here).
@joselfonseca what is your opinion on this ?
Showing the following error while trying to get users list,
ParseError: syntax error, unexpected 'Parser' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in file E:\xampp\htdocs\new-api\vendor\lcobucci\jwt\src\Configuration.php on line 22
#0 E:\xampp\htdocs\new-api\vendor\composer\ClassLoader.php(322): Composer\Autoload\includeFile('E:\xampp\htdocs...')
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass('Lcobucci\JWT\Co...')
#2 E:\xampp\htdocs\new-api\vendor\league\oauth2-server\src\AuthorizationValidators\BearerTokenValidator.php(74): spl_autoload_call('Lcobucci\JWT\Co...')
#3 E:\xampp\htdocs\new-api\vendor\league\oauth2-server\src\AuthorizationValidators\BearerTokenValidator.php(66): League\OAuth2\Server\AuthorizationValidators\BearerTokenValidator->initJwtConfiguration()
#4 E:\xampp\htdocs\new-api\vendor\league\oauth2-server\src\ResourceServer.php(67): League\OAuth2\Server\AuthorizationValidators\BearerTokenValidator->setPublicKey(Object(League\OAuth2\Server\CryptKey))
#5 E:\xampp\htdocs\new-api\vendor\league\oauth2-server\src\ResourceServer.php(84): League\OAuth2\Server\ResourceServer->getAuthorizationValidator()
#6 E:\xampp\htdocs\new-api\vendor\laravel\passport\src\Guards\TokenGuard.php(204): League\OAuth2\Server\ResourceServer->validateAuthenticatedRequest(Object(Nyholm\Psr7\ServerRequest))
#7 E:\xampp\htdocs\new-api\vendor\laravel\passport\src\Guards\TokenGuard.php(147): Laravel\Passport\Guards\TokenGuard->getPsrRequestViaBearerToken(Object(Illuminate\Http\Request))
#8 E:\xampp\htdocs\new-api\vendor\laravel\passport\src\Guards\TokenGuard.php(110): Laravel\Passport\Guards\TokenGuard->authenticateViaBearerToken(Object(Illuminate\Http\Request))
#9 E:\xampp\htdocs\new-api\vendor\laravel\passport\src\PassportServiceProvider.php(308): Laravel\Passport\Guards\TokenGuard->user(Object(Illuminate\Http\Request))
#10 [internal function]: Laravel\Passport\PassportServiceProvider->Laravel\Passport{closure}(Object(Illuminate\Http\Request), NULL)
#11 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Auth\RequestGuard.php(58): call_user_func(Object(Closure), Object(Illuminate\Http\Request), NULL)
#12 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Auth\GuardHelpers.php(60): Illuminate\Auth\RequestGuard->user()
#13 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Auth\Middleware\Authenticate.php(63): Illuminate\Auth\RequestGuard->check()
#14 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Auth\Middleware\Authenticate.php(42): Illuminate\Auth\Middleware\Authenticate->authenticate(Object(Illuminate\Http\Request), Array)
#15 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure), 'api')
#16 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#17 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Routing\Router.php(694): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#18 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Routing\Router.php(669): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#19 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Routing\Router.php(635): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#20 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Routing\Router.php(624): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#21 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(166): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#22 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
#23 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#24 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#26 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#27 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#28 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#30 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))
#31 E:\xampp\htdocs\new-api\vendor\fruitcake\laravel-cors\src\HandleCors.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#32 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
#33 E:\xampp\htdocs\new-api\vendor\fideloper\proxy\src\TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#34 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#36 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(141): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#37 E:\xampp\htdocs\new-api\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#38 E:\xampp\htdocs\new-api\public\index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#39 {main}
I think it would be nice to upgrade laravel/passport
to ^3.0
which will also upgrade league/oauth2-server
to 6.0.0
.
I locally upgraded and run tests and they all passed.
Motivations is it fixes security issues.
Here the diff for passport from 2.0.11 to 3.0.0. I don't see major breaking changes, except for the key encrypt part fix. (but you may want to double check this).
Here the diff for oauth from 5.1.3 to 6.0.0. Major changes seems to be related to file permissions for key files. (you may also want to double check this).
EDIT: for League oauth server, it seems it require one line to be changed.
Hey @kslimani
What do you think about dropping Dingo as it is not really being maintained? Can you tell me what specific things from Dingo you are tied to or want to still see in the starter kit. Also keep in mind that we now have Resources (https://laravel.com/docs/5.5/eloquent-resources) in Laravel so we could drop Fractal as well.
Let me know what you think.
I tried using:
php artisan api:docs --name Docs
but it only exports 3 lines:
FORMAT: 1A
# Docs
How are the .apib view files being generated?
We want to add docker compose file with all the services needed for the local development using this starter kit and docker.
Need an endpoint to let the users update passwords. From an admin and user point of view. Don't want to just update the database record in a PUT or PATCH endpoint along with the user's information.
What package can I use to update the existing api documentation after making changes?
Thank
Endpoint to allow the logged in user with the token to update the password. This will accept the following data
PUT /me/password
Authorization: Bearer TOKEN-HERE
{
"old_password": "old",
"password": "newPassword"
"password_confirmation": "newPassword"
}
Old password will help us verify the user is the account owner.
on creating a new user with the role return 500 Internal Server Error with
"message": "Return value of App\Entities\User::getStoredRole() must implement interface Spatie\Permission\Contracts\Role, null returned",
how to solve this issue
Me endpoint to get the logged in user profile.
install project by composer facing some problem .and missing doc........
1.app:install not run . error bellow
public function setTransformer() :TransformerAbstract
{
return app(UserTransformer::class);
}
$this->app->instance(ExceptionHandler::class, new class extends Handler {
>php artisan route:list
<oauth2 encryption key issue
>your project have vue.js for need
Thanks for creating a great stuff.
After following all steps, I could run 127.0.0.1:8000 and API explorer screen.
I also created the passport client called 'admin'.
What should I do next?
I get Unauthorized bugs when I run http://127.0.0.1:8000/api/users
There is an issue i missed when i proposed to upgrade laravel-permission to 2.4 : role and permissions are retrieved from database by name but using also guard name. (the logic is in the Spatie Role and Permission findByName methods).
Result is, for example, when using $user->hasRole('role-name')
, it request from database by name or uuid, but not guard name : this is an issue when using multiple guards.
I don't know yet how to fix this. (we could add guard name in the where condition in traits, but i dunno if it is the best way as it may be problematic to maintain).
Maybe simply drop support for checking if a user has role or permission by uuid could be a solution for fix this issue ? In fact, is checking a role by uuid instead of name usefull ?
i installed it
and can generate access token as password guard
put it give me 401 Unauthenticated when using it in postman
my post like
GET /api/users H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MUWVIbTumyi0MGUcZz2sqXgvfgEdzYGkQd0G0RmRbM7HTZOnME61G4oEKXf5yDj69YWLPVeukuQN34
Cache-Control: no-cache
Postman-Token: 26df83db-e57b-9853-f8b9-6c9d04f8d5cc
how to reset the password from a front end
which URL to call API reset password
@joselfonseca do you think that current release 3.1.0 could be used in production as base api skeleton or do you think it still require some work ? (my knowledge in api is low and this project is very great !)
Showing this response, pls tell me what to do
{
"error": "invalid_grant",
"error_description": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.",
"hint": "",
"message": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."
}
I think there is a small typo here (doesn't should be $role
instead of $user
?) - the code is working, it is only variable name. (not sure if it worth a PR ๐ธ)
Showing this response,
{
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
}
How can I find my client id
I get this error while running the app:install command.
Installing the app
[Symfony\Component\Debug\Exception\FatalErrorException]
syntax error, unexpected ':', expecting ';' or '{'
Hard to tell where the problem is. Help?
@kslimani What do you think about dropping dingo for the following reasons:
Also for the Spec change API Blueprint in favor of OpenAPI 3.0 spec.
Removing the command bus for the installation in favor of the Laravel Pipeline class is an option to remove a dependency.
Ability to upload an file in the API from URL or direct file stream.
Having the ability to upload a file in the API, we also want a way to render a file in the API.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.