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

Fix for issue #2209 | #2157 | #2205 | #2056 | #2116 #2219

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

MohammadMehrabani
Copy link

@MohammadMehrabani MohammadMehrabani commented Apr 15, 2023

I can refresh a non-expired token normally, but when I try to refresh an expired token, I get a 401 response with the message "Unauthenticated", even if the token is within the allowed refresh time.
fixed #2209 | #2157 | #2205 | #2056 | #2116 with: $this->middleware('auth:api', ['except' => ['login', 'refresh']]);

I can refresh a non-expired token normally, but when I try to refresh an expired token, I get a 401 response with the message "Unauthenticated", even if the token is within the allowed refresh time.
fixed with: $this->middleware('auth:api', ['except' => ['login', 'refresh']]);
@MohammadMehrabani MohammadMehrabani changed the title Fix for issue #2209 | #2157 Fix for issue #2209 | #2157 | #2205 Apr 15, 2023
@MohammadMehrabani MohammadMehrabani changed the title Fix for issue #2209 | #2157 | #2205 Fix for issue #2209 | #2157 | #2205 | #2056 | #2116 Apr 15, 2023
@maoxuner
Copy link

maoxuner commented Aug 30, 2023

return $this->respondWithToken(auth()->refresh());

Tymon\JWTAuth\Exceptions\JWTException should be handled or it will result in a server internal exception when token is invalid (not provided / blacklisted / out of refresh time / ...)

a example is:

    public function refresh()
    {
        try {
            return $this->respondWithToken(auth()->refresh());
        } catch (\Tymon\JWTAuth\Exceptions\JWTException $exception) {
            throw new AuthenticationException($exception->getMessage());
        }
    }

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

Successfully merging this pull request may close these issues.

None yet

2 participants