redis
redis copied to clipboard
Oauth2 refreshes the access_token problem when the refresh_token is not modified
When Oauth2 does not modify the refresh_token, it will continue to refresh the access_token, and the data in redis will continue to increase. Although these data have TTL, if the amount of data is large, there will be certain problems.
The problem can be solved by the following code.
iresult := s.cli.Get(s.wrapperKey(checkToken))
if err := iresult.Err(); err != nil && err != redis.Nil {
return err
} else if iresult.Val() == "" || iresult.Val() != basicID {
return s.remove(basicID)
}