Comments (5)
Please provide configuration config you have to reproduce
from cakephp-api.
` <?php
/**
- Copyright 2016 - 2019, Cake Development Corporation (http://cakedc.com)
- Licensed under The MIT License
- Redistributions of files must retain the above copyright notice.
- @copyright Copyright 2016 - 2019, Cake Development Corporation (http://cakedc.com)
- @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
use Authentication\Middleware\AuthenticationMiddleware;
use CakeDC\Api\Middleware\ParseApiRequestMiddleware;
use CakeDC\Api\Middleware\ProcessApiRequestMiddleware;
use CakeDC\Api\ApiInitializer;
return [
'Api' => [
// if service class is not defined we use crud fallback service
'ServiceFallback' => '\CakeDC\Api\Service\FallbackService',
// response rendered as JSend
'renderer' => 'CakeDC/Api.JSend',
// Data parse from cakephp request object
'parser' => 'CakeDC/Api.Form',
//routes inflector: specify underscore, dasherize, or false for neither/no inflection
'routesInflectorMethod' => false,
// version is not used
'useVersioning' => true,
'versionPrefix' => 'v',
// auth permission uses require auth strategy
'Auth' => [
'Crud' => [
'default' => 'auth'
],
],
'Middleware' => [
'authentication' => [
'class' => AuthenticationMiddleware::class,
'request' => ApiInitializer::class,
'method' => 'getAuthenticationService',
],
'apiParser' => [
'class' => ParseApiRequestMiddleware::class,
],
'apiProcessor' => [
'class' => ProcessApiRequestMiddleware::class,
],
],
'Service' => [
'default' => [
'options' => [],
'Action' => [
'default' => [
//auth configuration
'Auth' => [
//'allow' => '*', // PUBLIC ACCESS for all API endpoints, remove this line to secure
'authenticate' => [
'CakeDC/Api.Token' => [
'require_ssl' => false,
]
],
],
// default app extensions
'Extension' => [
// allow request from other domains
'CakeDC/Api.Cors',
// enable sort
'CakeDC/Api.Sort',
// load Hateoas
'CakeDC/Api.CrudHateoas',
// enable relations
'CakeDC/Api.CrudRelations',
]
],
// all index actions configuration
'Index' => [
'Extension' => [
// enable pagination for index actions
'CakeDC/Api.Paginate',
],
],
],
],
],
'Log' => [
'className' => 'File',
'scopes' => ['api'],
'levels' => ['error', 'info'],
'file' => 'api.log',
],
'Flysystem' => [
'expire' => '+1 day'
]
]
];`
from cakephp-api.
Hi,
since there was no more comment and no update do you need more info or am i doing something wrong and nobody told me?
An Update would be nice or at least some info on the status.
Kind Regard
from cakephp-api.
I'm having the same issue, and it is definitely an issue in the CakeDC\Api\Middleware\ParseApiRequestMiddleware::process()
funcion.
The middleware tries to parse the version from the uri path at line 63, and it matches well to "v1" (v1 here is just an example). Then on line 78 it tries to configure the service using "v1" as the value for the 2nd parameter for CakeDC\Api\Service\ConfigReader::serviceOptions()
function, which strictly checks the second parameter to be an integer or null.
It ovbiously fails because "v1" is NOT an integer.
There is no way to bypass this check without modifying the plugin's code or copying the middleware's code into another one inside our app, and reconfigure the plugin to use this new middleware.
from cakephp-api.
resolved in 8.0.7
from cakephp-api.
Related Issues (20)
- 8.0 branch crud not working - Forbidden authorization request HOT 4
- versioning config HOT 1
- problems with api HOT 42
- Jwt authentication is not working in 8.0.0 HOT 1
- JSendRenderer _error() function won't accept string as error code
- Can't install version >8.0.0 due to dependency on lcobucci/jwt:3.3.x-dev (suggestion: depend on stable version, latest is lcobucci/jwt:4.0.0) HOT 1
- All errors are returned with [status code 200 OK] in the response header. It should return the real status code of the exception. HOT 2
- CrudAction::_getEntities() should return a ResultSetInterface instead of a ResultSet - errors might happen if not.
- No way to disable SortExtension to prevent it of executing on some requests HOT 1
- loading a component inside action HOT 1
- JWT tokens not authorizing until a minute after refresh HOT 2
- API Route on my own service dosn't work HOT 4
- Cake 4 release HOT 1
- Missing \ Wrong documentation on routing HOT 2
- Disabling public access HOT 2
- Feature request: Improve Action::getData()
- Espose api for plugins HOT 1
- Dependency Injection inside service actions
- Unable to call method validateUnique in table provider for field username HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cakephp-api.