Skip to content

Commit

Permalink
chore(intreceptor): change returned err msg
Browse files Browse the repository at this point in the history
  • Loading branch information
ripls56 committed Oct 26, 2024
1 parent 05351c8 commit d71f6b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/server/internal/grpc/interceptor/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func (i *Interceptor) Auth(ctx context.Context) (context.Context, error) {

payload := *claims

// TODO: переделать на стринг билдер
_, err = i.tokenRepo.GetToken(ctx, fmt.Sprintf("%s:%s", payload["type"].(string), payload["uid"].(string)))
if err != nil {
switch {
Expand All @@ -54,7 +55,7 @@ func matchTokenErr(ctx context.Context, err error) (context.Context, error) {
case errors.Is(err, jwt.ErrTokenExpired):
return nil, status.Errorf(codes.Unauthenticated, "Token expired")
case errors.Is(err, jwt.ErrTokenParse):
return nil, status.Errorf(codes.InvalidArgument, "Token parse error")
return nil, status.Errorf(codes.InvalidArgument, "Wrong token signature")
case errors.Is(err, jwt.ErrTokenValidation):
return nil, status.Errorf(codes.Unauthenticated, "Token validation error")
default:
Expand Down

0 comments on commit d71f6b1

Please sign in to comment.