Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update : authenticate api #205

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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