Giter Site home page Giter Site logo

Comments (7)

agentk avatar agentk commented on May 7, 2024

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.

agentk avatar agentk commented on May 7, 2024

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.

rut4 avatar rut4 commented on May 7, 2024

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.

agentk avatar agentk commented on May 7, 2024

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.

rut4 avatar rut4 commented on May 7, 2024

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.

tymondesigns avatar tymondesigns commented on May 7, 2024

@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.

tymondesigns avatar tymondesigns commented on May 7, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.