Category : http

Authenticate web using Laravel Passport I’m Redirecting the Response by specifying the access token as a Bearer token in the Authorization header to the route. And getting below error. IlluminateAuthAuthenticationException: Unauthenticated. File: Controller.php $id = ‘1’; $accessToken = ‘passport_token_value’; return redirect(‘home/id=’.$id)->header(‘Authorization’, ‘Bearer ‘.$accessToken); I have assigned Laravel Passport custom middleware to protect and authenticate different ..

Read more

Yes I understand there is an excess of limit. But I need to get the status code, not the error way. Instead, it throws this message at me. How can I get the HTTP status code? return $response->getStatusCode(); This error comes; GuzzleHttpExceptionClientException Client error: `GET https://api.envato.com/v3/market/author/sale?code=xxxxxx-xxxx-xxxx-xx` resulted in a `429 Too Many Requests` response: {"error": ..

Read more

I am trying to run function from route name profile function is given below. class Profile extends Controller { function data(){ $data = Http::get(‘http://hris.kseb.in/osvtest/ksebltws/api.php/usrp/validateConsumerWS’)->body(); } When I am running this it does display anything on screen but for simple echo like this class Profile extends Controller { function data(){ $data = Http::get(‘http://hris.kseb.in/osvtest/ksebltws/api.php/usrp/validateConsumerWS’)->body(); } It redirecting ..

Read more

I set up a new project and everything is running properly but I am having this problem. At web.php, there is an error message: Auth::routes is highlighted. Error – Undefined type ‘Auth’. I followed the commands to create a PagesController at Controller and it was successfully done. At PagesController, I keyed in a function: public ..

Read more

I am trying to get a object using the relations in laravel. In my project, 1 instalation belongs to 1 project and 1 project can have many installations. In the migration i have coded like this: Projects: Schema::create(‘projects’, function (Blueprint $table) { $table->id(); $table->bigInteger(‘user_id’)->unsigned(); $table->string(‘name’); $table->boolean(‘removed’); $table->timestamps(); $table->foreign(‘user_id’)->references(‘id’)->on(‘users’); }); Installations: Schema::create(‘installations’, function (Blueprint $table) { ..

Read more

Forcing to redirect URI from http to https using Laravel 5.4 on Heroku Method I used to solve this problem: APP_URL: https://stackoverflow.com/a/45891292/6607216 MiddleWare: https://stackoverflow.com/a/45858789/6607216 Proxies: https://gist.github.com/ilhamsj/819369a56bb983eac018c5f4e04cda50 I tried to upgrade Laravel version to 5.6 and 5.8 but no luck also. Kind of wondering if Heroku is blocking something to privent redirect from http to https. ..

Read more

I have this parameter sent to my server from a bigbluebutton webhook request, but i can’t seem to parse it into json, object, array, or something to access the data inside it. [{"data":{"type":"event","id":"user-presenter-assigned","attributes":{"meeting":{"internal-meeting-id":"874459b8178f4675df2278cb5aa49e9c263bc9cb-1603783168934","external-meeting-id":"6fa144e60fe591f82755e93c9937050dd06be266"},"user":{"internal-user-id":"w_qyus3pijthsu","external-user-id":"w_qyus3pijthsu"}},"event":{"ts":1603783173048}}}] public function event_happened(Request $request){ $event = $request->event; $decoded = json_decode($event); return $decoded[0][‘data’]; //returns error (Error: Cannot use object of type stdClass as ..

Read more

I’ve got Laravel backend and I’m trying to make iOS to it, but there is no documentation. It is my first time with Laravel, so confused with the routes and middlewares. How do I compose URL from code below Route::middleware(‘auth:api’)->get(‘/user’, function (Request $request) { return $request->user(); }); // Passport authentication Route::group([ ‘prefix’ => ‘auth’ ], ..

Read more

laravel : 7.28.0 "php": "^7.2.5" When I enter any link it gives the following errors: SymfonyComponentHttpKernelExceptionNotFoundHttpException in /home/mick/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1064 and SymfonyComponentHttpKernelExceptionNotFoundHttpException in /home/mick/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:43 route files api.php -> Empty web.php Route::get(‘/’, ‘[email protected]’)->name(‘home’); Route::get(‘/clear’, ‘[email protected]’)->name(‘clear_cache’); Route::get(‘/installations’, ‘[email protected]’)->name(‘installations’); Route::get(‘/installations/step/2’, ‘[email protected]’)->name(‘installations_step_two’); Route::post(‘/installations/step/2’, ‘[email protected]’); Route::get(‘/installations/step/final’, ‘[email protected]’)->name(‘installation_final’); /** * Authentication */ Route::get(‘/login’, ‘[email protected]’)->name(‘login’)->middleware(‘guest’); Route::post(‘/login’, ‘[email protected]’); Route::any(‘/logout’, ‘[email protected]’)->name(‘logout’); Route::get(‘/register’, ‘[email protected]’)->name(‘register’)->middleware(‘guest’); Route::post(‘/register’, ‘[email protected]’); Route::get(‘/forgot-password’, ..

Read more

I am trying to build a sms notification using laravel, I want to execute a http url once i hit the function on a laravel’s controller with this code public function sendSMS() { return ‘https://api.smsglobal.com/http-api.php?action=sendsms&user=testuser&password=secret&from=Test&to=61447100250&text=Hello%20world’ } Am expecting this to execute the url to send the sms notification but with no avail, it will be ..

Read more

I have a curl http that i copy from Insomnia: $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_PORT => "8080", CURLOPT_URL => "http://localhost:8080/engine-rest/process-definition/novello:1:9193cb96-ff50-11ea-9734-0242f038e69f/start", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "", CURLOPT_HTTPHEADER => [ "content-type: application/json" ], ]); $response = curl_exec($curl); $err = curl_error($curl); ..

Read more

I want to send request to an API website containing nested params via Laravel Http Client (Laravel 7.x) $params = [ ‘type’ => ‘books’, ‘variables’ => [ ‘color’ => ‘red’, ‘size’ => ‘large’ ] ] I want my url to like this: http://example.com/?type=books&variables={"color":"red","size":"large"} encoded above url: http://example.com/?type=books&variables=%7B%22color%22%3A%22red%22%2C%22size%22%3A%22large%22%7D But when I use: Http::get(‘http://example.com’, $params); The API ..

Read more

I have the following code, which is working fine on my local machine: // … $host = $request->getHttpHost(); $accountResponse = Http::post("$host/api/stripe/account", [ ‘country_id’ => $request->country, ‘country’ => $country->abbr, ]); $accountResponse = json_decode($accountResponse); This will call another endpoint inside my app where I’m now just returning some json data for testing purposes, however when I try ..

Read more

Hello I want to return a json value in a view from an api, I am using GuzzleHttp, but I have the following error Undefined index: docs (View: /Applications/MAMP/htdocs/sep-api/resources/views/home.blade.php) THAT’S MY JSON { "responseHeader": { "status": 0, "QTime": 0, "params": { "fl": "*,score", "q": "8092316", "wt": "json" } }, "response": { "numFound": 1, "start": 0, ..

Read more

i have in Angular application (front). Api Laravel (Back). Domaine SSL (https). Like this when i disable SSL on my server it work with http: let url = ‘http://api.hamham.me/public/api/items’; this.http.get(url, { headers: new HttpHeaders().set(‘Accept’, ‘application/json’), }).subscribe((res) => { this.items = res; }); but when i use https it give me this error net::ERR_SSL_PROTOCOL_ERROR Error sceenshoot ..

Read more

this is a little bit strange because most of the questions here wanted to force https. While learning AWS elastic beanstalk. I am hosting a laravel site there. Everything is fine, except that none of my javascripts and css files are being loaded. If have referenced them in the blade view as : <script src="{{asset(‘assets/backend/plugins/jquery/jquery.min.js’)}}"></script> ..

Read more