func (s *authService) beginAuth(res http.ResponseWriter, req *http.Request, session sess.Session) { authSession, err := s.provider.BeginAuth(getState(req)) if err != nil { log.Error(fmt.Sprintf("Error creating auth session: %v", err)) return } session.Save(s.Config.SessionKey, authSession.Marshal()) url, err := authSession.GetAuthURL() if err != nil { log.Error(fmt.Sprintf("Could not get Auth URL: %v", err)) } http.Redirect(res, req, url, http.StatusTemporaryRedirect) }
func (s *authService) saveAuthSession(session sess.Session, authSession goth.Session) { session.Save(s.Config.SessionKey, authSession.Marshal()) }