list all wallets for current user (WA-9)

This commit is contained in:
Fran Jurmanović
2021-05-29 21:50:48 +02:00
parent 9531cc14fb
commit 035ed4b486
7 changed files with 63 additions and 6 deletions

View File

@@ -1,7 +1,6 @@
package middleware
import (
"fmt"
"os"
"strings"
"wallet-api/pkg/models"
@@ -21,9 +20,11 @@ func Auth(c *gin.Context) {
}
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
_, ok := token.Method.(*jwt.SigningMethodHMAC)
println(ok)
if !ok {
return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
exceptionReturn.ErrorCode = "401001"
exceptionReturn.StatusCode = 401
exceptionReturn.Message = "Invalid token"
c.AbortWithStatusJSON(exceptionReturn.StatusCode, exceptionReturn)
}
return []byte(secret), nil
})