22 lines
457 B
Go
22 lines
457 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/haydenhargreaves/Potion/internal/app/service"
|
|
)
|
|
|
|
func GoogleLogin(ctx *gin.Context) {
|
|
url := service.GoogleLogin(ctx)
|
|
ctx.Redirect(http.StatusSeeOther, url)
|
|
}
|
|
|
|
func GoogleCallback(ctx *gin.Context) {
|
|
if googleUserInfo, err := service.GoogleCallback(ctx); err != nil {
|
|
ctx.JSON(http.StatusInternalServerError, err)
|
|
} else {
|
|
ctx.JSON(http.StatusOK, googleUserInfo)
|
|
}
|
|
}
|