🐛 Fix didn't handle invalid auth sessions
This commit is contained in:
parent
ea460c3623
commit
437c2e5b4b
@ -46,6 +46,6 @@ func authFunc(c *fiber.Ctx, overrides ...string) error {
|
||||
c.Locals("principal", user)
|
||||
return nil
|
||||
} else {
|
||||
return err
|
||||
return fiber.NewError(fiber.StatusUnauthorized, err.Error())
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ func Authenticate(atk, rtk string) (models.Account, string, string, error) {
|
||||
})
|
||||
if err != nil {
|
||||
return user, reply.GetAccessToken(), reply.GetRefreshToken(), err
|
||||
} else if !reply.IsValid {
|
||||
return user, reply.GetAccessToken(), reply.GetRefreshToken(), fmt.Errorf("invalid authorization context")
|
||||
}
|
||||
|
||||
user, err = LinkAccount(reply.Userinfo)
|
||||
|
Loading…
Reference in New Issue
Block a user