Comments (3)
Hello!
It sounds pretty weird that passing the query param token
triggers CORS preflight. But implementing the bearer token is easy as:
- Register jwt auth middlewares in
Kernel.php
'jwt.auth' => 'Tymon\JWTAuth\Middleware\GetUserFromToken',
'jwt.refresh' => 'Tymon\JWTAuth\Middleware\RefreshToken',
- Add
jwt.auth
middleware to the privileged controllers or routes. - Add
Event::listen('tymon.jwt.valid')
hook in the boot function of theEventServiceProvider.php
, like this.
public function boot(DispatcherContract $events)
{
parent::boot($events);
Event::listen('tymon.jwt.valid', function($event)
{
Auth::setUser($event);
});
}
- Use
Auth::getUser()
to check user's model instance.
Hope that helps.
PS: This is just for Laravel 5
from jwt-auth.
@kthnxbye did you resolve this ?
from jwt-auth.
Yes sr i did, i'll post the answer in github just in case someone else is
having the same problem, actually it was a 'conflict' i dont know where
with another library, I was using a third-party lib to handle the cors but
i switched back the app/filter.php $request approach and it's been working
like a charm since then.
On Thu, Mar 19, 2015 at 2:20 PM, Sean Tymon [email protected]
wrote:
@kthnxbye https://github.com/kthnxbye did you resolve this ?
—
Reply to this email directly or view it on GitHub
#61 (comment)
.
from jwt-auth.
Related Issues (20)
- Cannot refresh an expired token even if the token is within the allowed refresh time HOT 2
- Class "Tymon\JWTAuth\Providers\JWT\Namshi" not found HOT 1
- setSecret not updating $config
- 401 Unauthorized but passing valid token
- Call to an undefined static method Illuminate\Support\Facades\Auth::refresh() HOT 1
- Performance consideration when only user id is needed
- Upgrade to v2.0 with lcobucci/jwt 4.3.0 crash with package:discover HOT 3
- JWTAuth::attempt return random token if input is null
- Default persistent claims should be configurable
- The GET method is not supported for route api/login. Supported methods: POST.
- post request by axios to laravel giving 500 error HOT 1
- How do we customise the claims? HOT 2
- Get All active tokens
- Method factory on JWTGuard not found
- setSecret method for custom JWT key is not working HOT 1
- Troubleshooting Issues with Laravel Tests and JWT Authentication HOT 2
- Examples for unmentioned routes (like Email Verification) HOT 1
- Followed the Laravel installation and quick start, getting error: "Tymon\\JWTAuth\\JWTGuard::login(): Argument #1 ($user) must be of type Tymon\\JWTAuth\\Contracts\\JWTSubject
- is possible use sap hana obdc with tymondesigns / jwt-auth ?
- Using a string instead of a file path for the `private` property in `jwt.php`.
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 jwt-auth.