lumen

Oauth2 Header - “Authorization: Bearer (token)” doesn't work

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 01:37:19
问题 I am using Lumen as backend. I successfully authenticated user and got the token, but when I am trying to get protected data, it doesn't let me with Authorization: Bearer TOKEN . I tried with both Postman & Swift. ( I also tried Authorization: BearerTOKEN ) I tried making a call from ios app and adding header: Authorization: Bearer y57WWNRNKNpJkXugT6v1YG7Et13PBgT5xNkAB1bg however it doesn't let me pass the validation. Specifically: let headers = ["Authorization": "Bearer \(token)"] Then I

Could not submit form-data through postman put request

扶醉桌前 提交于 2019-12-24 01:17:47
问题 I m using lumen api 5.6. This is my route $router->PUT('collections/{collectionId}' In postman i m calling this api like this. and this is the body of that request See here i have CollectioPoints here but its failing in validation. the data i m sending through formdata is not able to recognized in validation. But if i send the route from put to post [$router->POST('collections/{collectionId}'], all the data i m sending through form data are recognized and i m getting correct response as below

How to hide .env passwords in Lumen when you leave debug as false?

心已入冬 提交于 2019-12-23 23:27:00
问题 How can I hide my passwords and other sensitive environment variables on-screen in Lumen (Not Laravel)? Sometimes we either forget or test smth in development and make debug=false in the .env file. We maybe don't want other people to see such information even in development phase. Also for some people who don't know this, if an exception is thrown while opening a page or making a request, everything that is in the .env file is shown in the browser, including db passwords etc - "and this is

Can I get current route information in middleware with Lumen?

谁说胖子不能爱 提交于 2019-12-23 16:51:14
问题 I need to have the current found controller and action in a middleware, so that I can do some authentication. But I found it impossible, because the pipe is like Middleware1 -> Middleware2-> do the dispatching -> controller@action() -> Middleware2 -> Middleware1. Therefore before the dispatching, I cannot get the route info. It is definitely not right to do it after the $controller->action(). I did some research and found this. $allRoutes = $this->app->getRoutes(); $method = \Request:

How to neatly handle Exceptions in Artisan Commands

南笙酒味 提交于 2019-12-23 10:47:08
问题 Using Lumen to create an API - love Laravel but all the View's that come with it were overkill for the project I am creating. Anyway, I've made a series of Commands which go out and collect data and stores it to the database. <?php namespace App\Console\Commands; use Illuminate\Console\Command; use Symfony\Component\Console\Input\InputOption; use App\User; class GetItems extends Command { /** * The console command name. * * @var string */ protected $name = 'GetItems'; /** * The console

Installation failed for laravel/lumen-installer: guzzlehttp/guzzle locked at 6.3.0

百般思念 提交于 2019-12-23 02:48:07
问题 I'm trying to install Lumen through the command composer global require "laravel/lumen-installer" but throws the following error on terminal. Changed current directory to /home/lykos/.config/composer Using version ^1.0 for laravel/lumen-installer ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - Conclusion: don't install

Making use of the base path in Laravel 5 (Lumen)

烂漫一生 提交于 2019-12-22 05:28:17
问题 I am using laravel in a project. On my local machine the server I have to access is just laraveltest.dev . When I open this URL the project works fine and without problems. However, when I upload this on a testing server, where the stuff is located in a sub-foder, like this: laraveltest.de/test2/ . The public folder is at laraveltest.de/test2/public/ , but when calling laraveltest.de/test2/public the application always returns an 404 error. I thought this might be because of the base path, so

Method Illuminate\Auth\RequestGuard::attempt does not exist

故事扮演 提交于 2019-12-22 02:01:45
问题 I am new to both laravel and lumen. I was creating a login api with oauth2.0 in lumen 5.6, i have installed passport and generated token. Below is my login controller function and it is working fine. It returns token. namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Route; //use Illuminate\Support\Facades\DB; use App\User; use Auth; public function login(Request $request) { global $app; $proxy = Request::create( '

Laravel/Lumen file response

谁都会走 提交于 2019-12-21 19:49:15
问题 I need to stream file content (such as images and other mime types) from a Lumen resource server to a Laravel client server. I know in Laravel I can use: $headers = ['Content-Type' => 'image/png']; $path = storage_path('/mnt/somestorage/example.png') return response()->file($path, $headers); However, the file method is absent in Laravel\Lumen\Http\ResponseFactory . Any suggestions are very welcome. 回答1: In Lumen you can use Symfony's BinaryFileResponse . use Symfony\Component\HttpFoundation

Just installed Lumen and got NotFoundHttpException

会有一股神秘感。 提交于 2019-12-21 07:35:42
问题 I'm searching for a solution ... it's getting so frustrating. After a fresh installation of Lumen by Laravel, I simply can't access the "/" route. When I try to, it throws an error: NotFoundHttpException in RoutesRequests.php line 443: in RoutesRequests.php line 443 at Application->handleDispatcherResponse(array('0')) in RoutesRequests.php line 380 at Application->Laravel\Lumen\Concerns\{closure}() in RoutesRequests.php line 629 at Application->sendThroughPipeline(array(), object(Closure)) in