Category : postman

I have configured a Postman environment and everything seems to work except that I can’t login with Postman on http://localhost:8000/api/login. Accessing the api/login endpoint returns "message": "User login successfully" and creates the appropriate cookies, but all the other endpoints show "message": "Unauthenticated.". Everything works when I login thru http://localhost:8000/login but that’s not something I’d like ..

Read more

Following a tutorial: https://www.twilio.com/blog/build-secure-api-php-laravel-passport I manAged to get Laravel/Passport installed formy Laravel Api and Vue application. I managed to create attoken with: localhost:8000/oauth/token get the login working in Postman: localhost:8000/api/[email protected]&password=password Now when I try to register a user I get returned to the home-page. I do get some "undefined method" errors from VS Code, but ..

Read more

I created this api api routes on laravel.. Route::get(‘/items’, [ItemController::class, ‘index’]); Route::prefix(‘/item’, function () { Route::post(‘/store’, [ItemController::class, ‘store’]); Route::put(‘/{id}’, [ItemController::class, ‘update’]); Route::delete(‘/store’, [ItemController::class, ‘destroy’]); when I use GET requests on postman, everything works great but when I use POST requests I get 404 not Found Page! and this is my store function on Item Controller ..

Read more

I am learning laravel and php in general and I came upon using Laravel passport as authentication. I followed the documentation to replace the values in various config files. My Controller’s login function: public function login(Request $request) { $credentials = [ ’email’ => $request->email, ‘password’ => $request->password ]; if (auth()->attempt($credentials)) { $token = auth()->user()->createToken(‘[email protected]’)->accessToken; return ..

Read more

i follow this tutorial https://blog.codecourse.com/laravel-sanctum-airlock-with-postman/ and have issue like this Issue with POST requests with Laravel Sanctum and Postman but i set header according to the tutorial like this This is my post method Route::middleware(‘auth:sanctum’)->resource(‘application-forms’, ApplicationFormController::class)->only( [‘store’]); pre-request script pm.sendRequest({ url: ‘https://api.x.test/api/csrf-cookie’, method: ‘GET’ }, function (error, response, { cookies }) { if (!error) { ..

Read more

I have error when updating data on laravel, (Integrity constraint violation: 1048 Column ‘nama_user’ cannot be null (SQL: update users set nama_user = ?, email = ?, password = $2y$10$.xYE1yE99DkN2OdyCecI1OkIVqSdJQb8XIuumv7ALUiLxZLM7eX.K, role = ?, status = ?, users.updated_at = 2021-08-19 02:59:55 where id = 10) in file C:xampphtdocsmysmk-bevendorlaravelframeworksrcIlluminateDatabaseConnection.php on line 692) this is my controller code ..

Read more

I want to display my user score data together with the joint tables of user and organization. I also want to display the data using the User Score id. userScore Model: <?php namespace AppModels; use IlluminateDatabaseEloquentFactoriesHasFactory; use IlluminateDatabaseEloquentModel; class userScore extends Model { public $table = "user_scores"; use HasFactory; protected $guarded = []; public function ..

Read more

I am facing an issue in laravel, while performing update in postman . So the thing is I have product_template_option where I am trying to update the options related to template and insert in product_template_options: so here is the migration of product_template_option : public function up() { Schema::create(‘product_template_options’, function (Blueprint $table) { $table->engine = "InnoDB"; ..

Read more

I am facing an issue in apiresource . so the thing is I have questions who have many replies with it . here is the migration of reply : public function up() { Schema::create(‘replies’, function (Blueprint $table) { $table->id(); $table->text(‘body’); $table->unsignedBigInteger(‘question_id’); $table->integer(‘user_id’); $table->foreign(‘question_id’)->references(‘id’)->on(‘questions’)->onDelete(‘cascade’); $table->timestamps(); }); } here is the migration of questions : public function ..

Read more

I am trying to make an api authentication system with email verification but i get this error in postman: "message": "Connection could not be established with host smtp.mailtrap.io :stream_socket_client(): unable to connect to tcp://smtp.mailtrap.io:25 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed ..

Read more

In my API after the user registers, a token is created with this code : $token = JWTAuth::fromUser($user); when i use dd($token) , returns this : eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xMjcuMC4wLjE6ODAwMFwvYXBpXC9sb2dpbiIsImlhdCI6MTYyNjgxNDM2NCwiZXhwIjoxNjI2ODE3OTY0LCJuYmYiOjE2MjY4MTQzNjQsImp0aSI6Imd3eDZnVzNGTGN4MzlMekIiLCJzdWIiOjQsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ._m-7tojFaupUbAibDUbLJm6BeuFVL_etdFlwj0h5664 so how can i find the id of user without entering this token in authorization of postman ? Sourc..

Read more

Trying to simulate a POST request on postman for a callback function for API. It is from an external API posting the data to me so I did not include return in callback function. Here is my route: Route::post(‘toyyibpay-callback’,’[email protected]’)->name(‘toyyibpay-callback’); Controller: public function callback(Request $request){ Log::info(‘callback function is called’); $response = request()->all(); Log::info($response); if($request->status == 1){ ..

Read more

I have issue during register any user in the sanctum. I newly install sanctum to my Laravel and I got this issue after I give user and password and email in postman its giving me the below issue: "message": "Class "AppModelsPersonalAccessToken" not found", "exception": "Error", "file": "C:xampphtdocsapiappvendorlaravelframeworksrcIlluminateDatabaseEloquentConcernsHasRelationships.php", "line": 745, even though the user is created, ..

Read more

While making a request to my Laravel database something goes wrong. I’m trying to get different recipes on user input but Postman is returning ‘No recipes found’. My Laravel controller code: public function search(Request $request) { $fields = $request->validate([ ‘search’ => ‘required|string’ ]); // return response($request); $recipes = Recipe::where(‘title’, ‘LIKE’, ‘%’.$request.’%’)->get(); if (count($recipes) > 0 ..

Read more