[GH-ISSUE #22] Do we need separate functions for JWT verification and ID extraction? #14

Open
opened 2026-03-01 14:36:48 +03:00 by kerem · 0 comments
Owner

Originally created by @sreehari212000 on GitHub (Oct 31, 2025).
Original GitHub issue: https://github.com/amitshekhariitbhu/go-backend-clean-architecture/issues/22

Hey, I had a quick doubt, In https://github.com/amitshekhariitbhu/go-backend-clean-architecture/blob/main/internal/tokenutil/tokenutil.go both IsAuthorized and ExtractIDFromToken functions are doing almost the same token parsing and validation. Wouldn’t it be better to combine them into one function that verifies and returns claims or ID? Or is there a particular reason for keeping them separate?

Originally created by @sreehari212000 on GitHub (Oct 31, 2025). Original GitHub issue: https://github.com/amitshekhariitbhu/go-backend-clean-architecture/issues/22 Hey, I had a quick doubt, In `https://github.com/amitshekhariitbhu/go-backend-clean-architecture/blob/main/internal/tokenutil/tokenutil.go` both `IsAuthorized` and `ExtractIDFromToken` functions are doing almost the same token parsing and validation. Wouldn’t it be better to combine them into one function that verifies and returns claims or ID? Or is there a particular reason for keeping them separate?
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-backend-clean-architecture#14
No description provided.