tymondesigns / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.23k stars 1.55k forks source link

Send token payload to model? #2023

Open guice opened 3 years ago

guice commented 3 years ago

Subject of the issue

How do I send the token payload to the model? I'm building a localized user, using an aws cognito token. They are not within any database tables; user data is passed within the payload.

I've been doing all sorts of debug tracing, and I cannot find at point where you send the token payload. It doesn't look it's at all possible based on this generator:

    /**
     * Get the currently authenticated user.
     *
     * @return \Illuminate\Contracts\Auth\Authenticatable|null
     */
    public function user()
    {
        if ($this->user !== null) {
            return $this->user;
        }

        if ($this->jwt->setRequest($this->request)->getToken() &&
            ($payload = $this->jwt->check(true)) &&
            $this->validateSubject()
        ) {
            return $this->user = $this->provider->retrieveById($payload['sub']);
        }
    }

Your environment

Q A
Bug? unknown?
New Feature? maybe?
Framework Laravel
Framework version 7.x
Package version 1.x.y
PHP version 7.x.y
stale[bot] commented 3 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.