Comments (2)
Currently, the only way in Passport to pass your access token is through the Authorization header. Passing it through the query string is extremely dangerous, see here and here.
When using Passport as your guard, this is how you it checks for an authenticated user.
/**
* Get the user for the incoming request.
*
* @param Request $request
* @return mixed
*/
public function user(Request $request)
{
if ($request->bearerToken()) {
return $this->authenticateViaBearerToken($request);
} elseif ($request->cookie('laravel_token')) {
return $this->authenticateViaCookie($request);
}
}
So bearer token explicitly checks for the authorization header, but the cookie method simply looks for the laravel_token
cookie to be present during the request. The CreateFreshApiToken method sounds like it might work for you since you don't need to pass headers, just a simple cookie which the browser should handle automatically assuming your javascript doesn't have any problems.
That being said, that method also relies on how your intranet is setup and whether or not you have a "domain" which a cookie can be attached to.
from passport.
I do agree that it's dangerous and went ahead skipping that function completely in my project. I appreciate the information regarding the cookie, that may prove useful in the future. Went ahead and did a more regular method of authorization from the intranet app.
from passport.
Related Issues (20)
- Error attribute [grant_types] either does not exist or was not retrieved for App\Passport\Models\Client HOT 2
- whenever i try to install passport, laravel latest application HOT 7
- [11.x] No longer able to get or set scopes on a client
- no install the passport with laravel 19 HOT 1
- adding `last_used_at` on `oauth_access_tokens `table HOT 1
- Laravel Passport cannot assign client because field 'id' doesn't have a default value HOT 1
- Laravel Passport has error with Carbon. HOT 1
- Passport install prompt HOT 4
- Page expiration issue HOT 1
- Passport Failed Install In Laravel 11 HOT 2
- Data type mismatch on laravel 11 sqlite database HOT 4
- New major version required for league/oauth2-server 9 HOT 11
- Custom claim support HOT 1
- Token Revocation Notifications HOT 1
- Cannot Custom Handle `Laravel\Passport\Exceptions\OAuthServerException` in Laravel 11 HOT 7
- Laravel/Passport Installation Error Cause of HasApiTokens Trait HOT 5
- Mongodb support HOT 1
- Purge command using wrong query for expired tokens HOT 2
- Does anyone know of a new solution that works with versions of Laravel 10 and up? HOT 1
- your php version (8.0.2) does not satisfy that requirement. HOT 1
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.