The 'username' key is missing from the given credentials array - php

Laravel Version: 9.11
Adldap2-Laravel Version: 6.1.6
PHP Version: 6.1.6
LDAP Type: ActiveDirectory
Description:
I'm trying to Authenticate to my Active Directory with Laravel project. But i faced to this error message The 'username' key is missing from the given credentials array when i try to log in.
Steps i've followed:
composer require adldap2/adldap2-laravel
Adldap\Laravel\AdldapServiceProvider::class,
Adldap\Laravel\AdldapAuthServiceProvider::class,
'Adldap' => Adldap\Laravel\Facades\Adldap::class,
php artisan vendor:publish
in the file ldap.php i made this changes
'hosts' => explode(' ', env('LDAP_HOSTS', '...')),
'base_dn' => env('LDAP_BASE_DN', 'DC=host,DC=com'),
'username' => env('LDAP_USERNAME', 'Admin_username'),
'password' => env('LDAP_PASSWORD', 'Admin_password''),
auth.php
'providers' => [
'users' => [
'driver' => 'ldap', // Was 'eloquent'.
'model' => App\User::class,
],
also ENV.
LDAP_LOGGING=true
LDAP_CONNECTION=default
LDAP_HOST='...'
LDAP_USERNAME=''
LDAP_PASSWORD=''
LDAP_PORT=389
LDAP_BASE_DN="DC=*,DC="
LDAP_TIMEOUT=5
LDAP_SSL=false
LDAP_TLS=false
then i use the command php artisan adldap:import it shows me that
Found 418 user and when i want to import them successfully imported
/ synchronized 0 user(s) also i tested if the connexion is working
with php native and that's worked.
Can someone help me ?
Thanks

Related

Php lumen, artisan passport:install error

Following all the instructions in the document of dusterio / lumen-passport,
Running php artisan passport:install after all the instructions in the document gives me the following error.
Encryption keys generated successfully.
Personal access client created successfully.
Client ID: 1
Client secret: EQXIlANzcONLH7IvXOi6bRuSHxOqemZVKjMOHC5I
In ChoiceQuestion.php line 36:
Choice question must have at least 1 choice available.
Been on this the entire night.
First of all, I guess you have followed this documentation.
This type of error comes when $app->configure('auth'); could not find the auth.php at <YOUR_PROJECT>/config/auth.php.
While make mistake to put the config directory in app viz. <YOUR_PROJECT>/app/config/auth.php
Check the config directory location, it must be just under the project's root directory.
STEP 1: Add $app->configure('auth'); in your bootstrap\app.php
$app->register(App\Providers\AuthServiceProvider::class);
$app->register(Laravel\Passport\PassportServiceProvider::class);
$app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
$app->configure('auth');
STEP 2: Go to file vendor\laravel\lumen-framework\config\auth.php and change the 'guards' and 'providers'
'guards' => [
'api' => [
'driver' => 'passport',
'provider' => 'users'
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => \App\Models\User::class
]
],
STEP 3: Run php artisan migrate:fresh
STEP 4: Run php artisan passport:install --force

why laravel 5.6 returns file does not exist error?

I putted file on project-dir/client_secret_1***.apps.googleusercontent.com.json and then added variable into env file.
GOOGLE_PLAY_CREDENTIAL=http://local.project-dir/client_secret_1***.apps.googleusercontent.com.json
and then in config/services.php
return [
'google_play' => [
'credential' => env('GOOGLE_PLAY_CREDENTIAL'),
],
];
So now when I use it as like below
$client->setAuthConfig(config('services.google_play.credential'));
it is returning error which is
"file "http://local.project-dir/client_secret_1***.apps.googleusercontent.com.json" does not exist"
Can someone kindly guide me, where I am wrong so that I can fix the issue. I would like to appreciate.
Thanks
Use Laravel Storage.
Edit config/filesystems.php to create new disk:
'services' => [
'driver' => 'local',
'root' => storage_path('app/services'),
],
// ...
Put your .json file into %your_project_root%/storage/app/services/
Edit .env file:
GOOGLE_PLAY_CREDENTIAL=client_secret_1***.apps.googleusercontent.com.json
Change setAuthConfig param:
$client->setAuthConfig(Storage::disk('services')->get(config('services.google_play.credential')));
Test your storage using Tinker in console:
php artisan tinker
Storage::disk('services')->get(config('services.google_play.credential'));

How to enable mount network disk in elfinder laravel for google drive

I have question of elfinder, how to enable 'Mount Network Disk' on elfinder for use google drive in laravel 5.2. Could tell you me, which are steps to follow.
The steps i followed were:
Installation with composer.
composer require barryvdh/laravel-elfinder
Add the ServiceProvider to the providers array in app/config/app.php
Barryvdh\Elfinder\ElfinderServiceProvider::class
Copy the assets to the public folder, using the following artisan command:
php artisan elfinder:publish
Run command.
composer update
I used the default configuration, I created the folder 'files' in the public folder.
With the command
php artisan vendor:publish --provider='Barryvdh\Elfinder\ElfinderServiceProvider' --tag=config
and
php artisan vendor:publish --provider='Barryvdh\Elfinder\ElfinderServiceProvider' --tag=views
In the file elfinder.php with the route
'vendor/barryvdh/laravel-elfinder/config/elfinder.php'
In the section route use
'route' => [
'prefix' => 'elfinder',
'middleware' => null, //Set to null to disable middleware filter
]
In the file filesystems.php with the route
'/config/filesystems.php'.
In the section disk in the option public, add the line
'root' => base_path().'app/public',
after of the line
'driver' => 'local',
Example:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => base_path().'app/public',
'root' => storage_path('app/public'),
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => 'your-key',
'secret' => 'your-secret',
'region' => 'your-region',
'bucket' => 'your-bucket',
],
],
This is how i solved the error that occurs when you use the copy option, open folder, etc.
Error, Unable to connect to backend. HTTP error 0
But I do not know, what is needed to use the mount network disk.And
how to give the folder(example: Reading)
This is link of the project
https://github.com/AlonsoCauich/driveOne

Laravel 5.2 Mongo MonogDB Failed to parse MongoDB URI

I am getting this error:
MongoDB\Driver\Exception\InvalidArgumentException: Failed to parse MongoDB URI: 'mongodb://mongo:tcp://172.17.0.3:27017/mydatabase' in /var/www/laravel/vendor/mongodb/mongodb/src/Client.php:81
My enviroment variables look like this:
MONGO_DATABASE="mydatabase"
MONGO_HOST="mongo"
MONGO_PASSWORD=""
MONGO_PORT="27017"
MONGO_USERNAME=""
and my database.php looks like this
'mongodb' => [
'driver' => 'mongodb',
'host' => env('MONGO_HOST', 'localhost'),
'port' => env('MONGO_PORT', 27017),
'database' => env('MONGO_DATABASE', 'mydatabase'),
'username' => env('MONGO_USERNAME', ''),
'password' => env('MONGO_PASSWORD', ''),
'options' => [
'database' => 'admin' // sets the authentication database required by mongo 3
]
I can correctly ping mongo from the container and it resolves to 172.17.0.3 as per the connection string. It seems as if the rest of the connection string is not getting generated correct?
I am running Laravel 5.2 and my package.json has this entry
"mongodb/mongodb": "^1.0.0",
"jenssegers/mongodb": "3.0.*",
As per https://github.com/jenssegers/laravel-mongodb 3.0.X is highest compatibility for Laravel 5.2.
Many thanks in advance
After further investigation my link from Amazon ECS was passing another MONGO_PORT which was overriding the env set in my .env file.

Laravel Redis configuration

I am currently creating an app with Laravel and Redis. Almost everything is working fine. I extended the Authentication as explained in the documentation, users can subscribe, login, logout ... I can create content and everything is stored in Redis.
But I have one issue. I can't run commands like "php artisan route:list", I have an error message : "[InvalidArgumentException] Database [redis] not configured.".
Th question is, is there anything special to do to make Artisan commands work when you set Redis as you database ? (basic configurations explained in the documention have been done and almost everything else is working fine).
Config:
In config/database.php I have:
return [
...
'default' => 'redis',
...
'redis' => [
'cluster' => false,
//'connection' => 'default',
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 7,
],
],
...
PS : You have the same error when you try to access the /password/email (password reset url).
InvalidArgumentException in DatabaseManager.php line 246:
Database [redis] not configured.
As Robert says in the comments, it looks like there is this error because there is no support for Redis as database for laravel.

Categories