feat: add login-wall app

This commit is contained in:
Lakhan Samani
2021-07-30 23:42:15 +05:30
parent d1973c1f8f
commit 4a37815a44
31 changed files with 2119 additions and 72 deletions

View File

@@ -10,11 +10,22 @@ import (
"github.com/google/uuid"
)
func OAuthLoginHandler() gin.HandlerFunc {
uuid := uuid.New()
oauthStateString := uuid.String()
// set host in the oauth state that is useful for redirecting
func OAuthLoginHandler() gin.HandlerFunc {
return func(c *gin.Context) {
// TODO validate redirect URL
redirectURL := c.Query("redirect_url")
if redirectURL == "" {
c.JSON(400, gin.H{
"error": "invalid redirect url",
})
return
}
uuid := uuid.New()
oauthStateString := uuid.String() + "___" + redirectURL
provider := c.Param("oauth_provider")
switch provider {