From 86027a1ca97cfd4d03d51919e0759093f7ac1546 Mon Sep 17 00:00:00 2001 From: Punarv Pawade Date: Mon, 22 Apr 2024 21:40:44 +0530 Subject: [PATCH 1/2] Paseto: Fix wrong response --- api/v1/authenticate/paseto/paseto.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/v1/authenticate/paseto/paseto.go b/api/v1/authenticate/paseto/paseto.go index b4225a3..2b952ad 100644 --- a/api/v1/authenticate/paseto/paseto.go +++ b/api/v1/authenticate/paseto/paseto.go @@ -63,12 +63,12 @@ func PASETO(c *gin.Context) { defer resp.Body.Close() var responseBody webappResponse err = json.NewDecoder(resp.Body).Decode(&responseBody) - fmt.Println("Wallet Address: ", responseBody.WalletAddress) + fmt.Println("Wallet Address: ", responseBody.Payload.WalletAddress) if err != nil { fmt.Printf("Failed to decode response body: %s\n", err) return } else { - c.Set("walletAddress", responseBody.WalletAddress) + c.Set("walletAddress", responseBody.Payload.WalletAddress) c.Next() } // parser := gopaseto.NewParser() From da06151c3b90d5ae5ff7cb92783c569d4575cebc Mon Sep 17 00:00:00 2001 From: Punarv Pawade Date: Mon, 22 Apr 2024 21:41:53 +0530 Subject: [PATCH 2/2] paseto: Update response struct --- api/v1/authenticate/paseto/types.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/v1/authenticate/paseto/types.go b/api/v1/authenticate/paseto/types.go index b2c1956..0bcf28b 100644 --- a/api/v1/authenticate/paseto/types.go +++ b/api/v1/authenticate/paseto/types.go @@ -5,5 +5,10 @@ type GenericAuthHeaders struct { } type webappResponse struct { - WalletAddress string `json:"walletAddress"` + Status int `json:"status"` + Message string `json:"message"` + Payload struct { + UserID string `json:"userId"` + WalletAddress string `json:"walletAddress"` + } `json:"payload"` }