package handlers import ( "net/http" "github.com/gin-gonic/gin" domain "github.com/haydenhargreaves/Potion/internal/domain/server" ) func GoogleLogin(ctx *gin.Context) { deps := ctx.MustGet("deps").(*domain.InjectedDependencies) url := deps.AuthService.GetGoogleAuthUrl() ctx.Redirect(http.StatusSeeOther, url) } func GoogleCallback(ctx *gin.Context) { deps := ctx.MustGet("deps").(*domain.InjectedDependencies) var ( state string = ctx.Query("state") code string = ctx.Query("code") ) if dbUser, googleUserInfo, err := deps.AuthService.GoogleAuthSuccess(state, code); err != nil { ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) } else { ctx.JSON(http.StatusOK, gin.H{"googleUserInfo": googleUserInfo, "dbUser": dbUser}) } }