Skip to content

Commit

Permalink
Merge pull request #205 from NetSepio/rushikesh-auth
Browse files Browse the repository at this point in the history
update : authenticate api
  • Loading branch information
Rushikeshnimkar authored Oct 12, 2024
2 parents 1cbde31 + 98c1ca6 commit 68a5dbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api/v1/authenticate/authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ func authenticate(c *gin.Context) {
}
if isCorrect {
// update wallet address for that user_id
err = db.Model(&models.User{}).Where("user_id = ?", userId).Update("wallet_address", walletAddr).Error
err = db.Model(&models.User{}).Where("user_id = ?", userId).
Updates(map[string]interface{}{
"wallet_address": walletAddr,
"chain_name": req.ChainName,
}).Error
if err != nil {
httpo.NewErrorResponse(http.StatusInternalServerError, "Unexpected error occured").SendD(c)
logwrapper.Errorf("failed to update wallet address, error %v", err.Error())
httpo.NewErrorResponse(http.StatusInternalServerError, "Unexpected error occurred").SendD(c)
logwrapper.Errorf("failed to update wallet address and chain name, error %v", err.Error())
return
}

Expand Down
1 change: 1 addition & 0 deletions api/v1/authenticate/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type AuthenticateRequest struct {
Message string `json:"message" binding:"omitempty"`
AccessToken string `json:"accessToken" binding:"omitempty"`
IdToken string `json:"idToken" binding:"omitempty"` // to be pass in bearer token [ AUTHORIZATION KEY ]
ChainName string `json:"chain_name" binding:"required"`
}
type AuthenticateRequestNoSign struct {
FlowId string `json:"flowId" binding:"required"`
Expand Down

0 comments on commit 68a5dbb

Please sign in to comment.