golang-clean-web-api icon indicating copy to clipboard operation
golang-clean-web-api copied to clipboard

feat: add refresh token endpoint and related configurations

Open alielmi98 opened this issue 8 months ago • 0 comments

New Feature: -Implemented the RefreshToken method in the TokenUsecase to handle token refreshing. -The method retrieves the refresh token from the HTTP cookie, validates it, and generates a new access and refresh token pair.

Details: -Extracts the refresh token from the cookie using c.Cookie. -Validates the refresh token and extracts claims using the GetClaims method. -Converts roles from []interface{} to []string for proper type handling. -Generates a new token pair using the GenerateToken method.

Reason for Addition: -To provide functionality for refreshing expired access tokens while maintaining security through refresh tokens. -This is a critical feature for session management in the application.

Benefits: -Enables secure token lifecycle management. -Improves user experience by allowing seamless token refresh without requiring re-login.

alielmi98 avatar Mar 21 '25 22:03 alielmi98