refactor: return all values from body in the providers

This commit is contained in:
Stavros
2025-04-25 15:02:34 +03:00
parent 4dc6bc0c98
commit 13032e564d
5 changed files with 67 additions and 61 deletions

View File

@@ -613,14 +613,23 @@ func (h *Handlers) OauthCallbackHandler(c *gin.Context) {
return
}
// Get email
email, err := h.Providers.GetUser(providerName.Provider)
log.Debug().Str("email", email).Msg("Got email")
// Get user
user, err := h.Providers.GetUser(providerName.Provider)
// Handle error
if err != nil {
log.Error().Msg("Failed to get email")
log.Error().Msg("Failed to get user")
c.Redirect(http.StatusPermanentRedirect, fmt.Sprintf("%s/error", h.Config.AppURL))
return
}
log.Debug().Msg("Got user")
// Get email
email, ok := user["email"].(string)
if !ok {
log.Error().Msg("Failed to get email from user")
c.Redirect(http.StatusPermanentRedirect, fmt.Sprintf("%s/error", h.Config.AppURL))
return
}