Skip to content

Instantly share code, notes, and snippets.

@as27
Created March 10, 2017 20:57
Show Gist options
  • Save as27/2cb26760f5087be1d53ac955e6e5cf43 to your computer and use it in GitHub Desktop.
Save as27/2cb26760f5087be1d53ac955e6e5cf43 to your computer and use it in GitHub Desktop.
Buffalo Auth Tutorial - modification in the AuthCallback
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