Comments (7)
Hi rut4,
I've just hit the same error too, submitted pull request #37 .
It was just a missed return statement when abstracting the eloquent query.
from jwt-auth.
Also if you want to skip the blacklist checking to be able to use the 'file' cache drive again, you can specify in .env
:
JWT_BLACKLIST_ENABLED=false
from jwt-auth.
Hi agentk,
Thank you.
But now I have an another error.
I installed a memcached, try to use it and I have a 'token_expired' error.
I rollback all changes but error still appearing similarly in the issue #24
from jwt-auth.
Hmmm. I'm not actually using memcached or the JWTAuthMiddleware at all in the application I'm testing as it's just a simple API.
If you want to dig into it more, a good place to start would be vendor/tymon/jwt-auth/src/Middleware/JWTAuthMiddleware.php:46
And start with something simple by inserting dd($token);
to see if it's picking up as expected to start with.
from jwt-auth.
I did it.
The first I set CACHE_DRIVER=memcached
(or one can add JWT_BLACKLIST_ENABLED=false
as agentk wrote).
Also I check timezone in app/config.php, it was wrong, so I changed it.
Next I change file as well as in the pull request #37 .
And the last one, in my case:
Route::group(['prefix' => 'api', 'middleware' => 'auth.jwt'], function () {
Route::get('user', function () {
$user = JWTAuth::toUser(JWTAuth::getToken());
return response()->json(compact('user'));
});
});
I should use JWTAuth::toUser(JWTAuth::getToken())
instead of JWTAuth::getToken()->toUser()
or JWTAuth::parseToken()->toUser()
.
from jwt-auth.
@rut4 Glad you sorted it :)
@agentk thanks for chipping in there 👍
I need to look over the token extraction behaviour, to make sure everything is as it should be (with tests!)
from jwt-auth.
the following should work:
JWTAuth::parseToken()->toUser();
it may be preferable to set the request instance if available:
JWTAuth::setRequest($request)->parseToken()->toUser();
from jwt-auth.
Related Issues (20)
- 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`.
- Clarification on Refresh Token Behaviour HOT 5
- attempt() never returns null, but returns blank booleans HOT 1
- Laravel 11 requires an update.
- Laravel 11 Compatibility needs nesbot/carbon ^3.0 HOT 1
- Random @deprecated docs
- Not authenticating api.php routes requests. HOT 3
- Wrong remaining minutes when blacklisting a token HOT 4
- Duplicate query to blacklisted tokens table
- Error when using the auth()->tokenById($id) function. HOT 1
- Redis connection to store blacklisted jwts HOT 1
- How does the jwt invlalidating works ? HOT 1
- TypeError: Carbon\Carbon::rawAddUnit(): Argument #3 ($value) must be of type int|float, string given, HOT 3
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.