The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed
15,748
you required 'username' field and passing value in postman parameter After all your code is absolutly right.nothing error.

Author by
oshabz
Updated on June 27, 2022Comments
-
oshabz 11 months
I am developing an auth api with laravel, passport and postman. I have seen related post but none of them solved my problem. If I try to send a request it shows me this error. I have tried all I can but it just displays this error
{ "error": "invalid_request", "message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.", "hint": "Check the `username` parameter" }
my value for the application is
{ "grant_type" : "password", "client_id" : "2", "client_secret" : "fsDFrzGtmpMjoxWtplnvcmgKT3USzKFfKQu6alGF", "email":"[email protected]", "pssword" : "12345", "scope" : "*" }
api.php
<?php use Illuminate\Http\Request; Route::middleware('auth:api')->get('/user', function (Request $request) { return $request->user(); }); Route::post('signup', 'SignUp@signUp');
auth.php
'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'passport', 'provider' => 'users', ], 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\User::class, ],
User.php
class User extends Authenticatable { use Notifiable; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password','vCode', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ];
AuthServiceProvider.php
namespace App\Providers; use Laravel\Passport\Passport; use Illuminate\Support\Facades\Gate; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; class AuthServiceProvider extends ServiceProvider { /** * The policy mappings for the application. * * @var array */ protected $policies = [ 'App\Model' => 'App\Policies\ModelPolicy', ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); // Passport::routes(); } }
Please any solution will be really appreciated