Created
March 10, 2017 20:57
-
-
Save as27/2cb26760f5087be1d53ac955e6e5cf43 to your computer and use it in GitHub Desktop.
Buffalo Auth Tutorial - modification in the AuthCallback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func AuthCallback(c buffalo.Context) error { | |
user, err := gothic.CompleteUserAuth(c.Response(), c.Request()) | |
if err != nil { | |
return c.Error(401, err) | |
} | |
session := c.Session() | |
session.Set("userID", user.UserID) | |
err = session.Save() | |
if err != nil { | |
return c.Error(401, err) | |
} | |
return c.Redirect(http.StatusMovedPermanently, "/secure") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment