feat: frontend
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"ordr-api/dto"
|
||||
"os"
|
||||
|
||||
"github.com/gin-contrib/sessions"
|
||||
@@ -81,7 +82,10 @@ func LoginHandler(auth *Authenticator) gin.HandlerFunc {
|
||||
}
|
||||
audience_url := "https://" + os.Getenv("AUTH0_DOMAIN") + "/api/v2/"
|
||||
auth_url := auth.AuthCodeURL(state, oauth2.AccessTypeOffline, oauth2.SetAuthURLParam("audience", audience_url))
|
||||
ctx.Redirect(http.StatusTemporaryRedirect, auth_url)
|
||||
var redirect dto.LoginRedirect
|
||||
redirect.Status = "200 OK"
|
||||
redirect.Location = auth_url
|
||||
ctx.JSON(http.StatusOK, redirect)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +167,7 @@ func AuthenticationCallbackHandler(auth *Authenticator) gin.HandlerFunc {
|
||||
}
|
||||
|
||||
// Redirect to logged in page.
|
||||
ctx.Redirect(http.StatusTemporaryRedirect, "/user")
|
||||
ctx.Redirect(http.StatusTemporaryRedirect, os.Getenv("LOGGED_IN_REDIRECT"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user