Comments (6)
Hi @johnef. In latest versions of Laravel when you run php artisan vendor:publish
command all providers available are shown. You should choose SMartins\PassportMultiauth\Providers\MultiauthServiceProvider
.
You can run too:
php artisan vendor:publish --provider="SMartins\PassportMultiauth\Providers\MultiauthServiceProvider"
from passport-multiauth.
@sfelix-martins thanks for the replay I am using Laravel 5.4,
When I run php artisan vendor:publish --provider="SMartins\PassportMultiauth\Providers\MultiauthServiceProvider"
I got the vendor\smartins\passport-multiauth\database\migrations
copied to my migration folder which I did migrate and everything was OK with this step but what to do with the providers here?
and then comes to the part Add the provider parameter in your request at /oauth/token
I can't understand this part too.
I made all the steps you mention and try to test on postman but from where can I get the client_id
and client_secret
sorry I am new to this passport and laravel APIs can you please guide me here
from passport-multiauth.
- Any packages has migrations, config files, translations, views and you can publish this files to see, edit, etc. In my package the command just publish a migration file. But it's not required to package works.
- On laravel passport installation you need to run
php artisan passport:install
to create the encryption keys needed to generate secure access tokens. You should to use theclient_id
andclient_secret
from "password grant" shown by command output. - After install Laravel Passport, on standard use, to create an access token you should send a POST to
/oauth/token
route passingclient_id
andclient_secret
(Generated on php artisan passport:install),grant_type
,username
andpassword
. To use my package correctly you need add tooauth/token
request the parameterprovider
passing the any provider defined onconfig/auth.php
providers array.
Example:
In your config/auth.php
providers array you add a new provider admins
:
return [
...
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
// ** New provider**
'admins' => [
'driver' => 'eloquent',
'model' => App\Administrator::class,
],
],
];
In your request parameters should looks like:
// The username and password of any admin created in your API
username: "[email protected]"
password: "password"
// The grant_type with value `password`
grant_type: "password"
// The client_id and client_secret generated by `php artisan passport:install` command
client_id: "client-id"
client_secret: "client-secret"
// Any provider defined previously
provider: "admins"
The package instructions assumes that the package user already has a previously knowledge in Laravel Passport. I will improve it to make the experience easier.
I hope it helps, Thanks!
from passport-multiauth.
@sfelix-martins thanks really for your effort but I try all the steps you just said but when test on postman I get always "error": "Unauthenticated."
from passport-multiauth.
@sfelix-martins one more question I see this in the vendor\smartins\passport-multiauth\src\Http\Middleware\AddCustomProvider.php
dose it should be published in my Middleware
because I see my Middleware is same same even after installing the package.
from passport-multiauth.
The middleware don’t need to be published to your middlewares. You need just use the middleware. Please, list all steps that you follow to install and configure the package on your project.
from passport-multiauth.
Related Issues (20)
- Auth::attempt() not working HOT 6
- Cannot generate tokens even after providing all form-data correctly. Results with error: { "error": "invalid_credentials", "message": "The user credentials were incorrect." }
- Unable to logout HOT 8
- Error with social login
- When i try to install it on laravel 6 this error (RepositorySecurityException) appear HOT 1
- Its giving me this error on laravel 6 HOT 4
- Support for Passport 8.0 HOT 3
- ignoreMigrations() doesn't exist anymore HOT 5
- Getting unauthenticated error when i try using token of user from id 2, the first user works well HOT 1
- Unit tests as defined is not working HOT 2
- Class 'Symfony\\Bridge\\PsrHttpMessage\\Factory\\DiactorosFactory' not found HOT 12
- Passport route /oauth/personal-access-token not limited to model
- Class 'Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory' not found HOT 2
- I can set provider 'admins' for refreshing tokens even if refresh token is for 'user' HOT 1
- Error "Route [login] not defined"
- Authenticated model without middleware not correct
- During installing of sfelix-martins/passport-multiauth HOT 2
- Login attempt fails
- Laravel / frameworl ^ 8. X and laravel / Passport ^ 10.0 are not supported HOT 6
- Error while using grant_type client_credentials
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from passport-multiauth.