appleboy / appleboy/gin-jwt

refresh_token error when i'am pass token failed

Open
#188 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
3k
Forks
387
Avg merge
4h 16m
Merged PRs (30d)
1

Description

hi there,

iam trying to create testing file with a middleware (gin jwt), so when i'am access the page /refresh_token and then iam pass the wrong value of prev token, i got a panic "invalid memory address or nil pointer dereference"

i check your code and i think you must validate a token
on line: 415 : token, _ := mw.parseToken(c)

because your function parseToken() retrun nil when error

maybe it's snipped can help.

added online 416:

if token == nil {
mw.unauthorized(c, http.StatusUnauthorized, mw.HTTPStatusMessageFunc(ErrExpiredToken, c))
return
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the refresh_token middleware path around the reported line where parseToken(c) is called, and reproduce the request with an invalid previous token. Trace the nil result and confirm that the completed behavior returns an unauthorized response instead of panicking.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.