Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to an undefined static method Illuminate\Support\Facades\Auth::refresh() #2218

Open
khrigo opened this issue Apr 3, 2023 · 1 comment

Comments

@khrigo
Copy link

khrigo commented Apr 3, 2023

Subject of the issue

I receiving from phpstan Call to an undefined static method Illuminate\Support\Facades\Auth::refresh()

Your environment

Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 10.0
Package version 2.0
PHP version 8.1
@kingkero
Copy link
Contributor

The default Auth facade does not support the refresh() method, it is specific to JWTGuard. You can use a workaround like

    $guard = Auth('api');
    if (! $guard instanceof JWTGuard) {
        // handle wrong guard, i.e. throw runtime exception
    }

    return response()->json([
        'token_type' => 'Bearer',
        'access_token' => $guard->refresh(),
    ]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants