Exemple #1
0
// Handler for authorizing user
func authHandler(w http.ResponseWriter, r *http.Request) {
	log.Println("Redirecting to SO login")
	auth_url := backend.AuthURL()
	header := w.Header()
	header.Add("Location", auth_url)
	w.WriteHeader(302)
}
Exemple #2
0
// Handler for authorizing user
// Redirects user to a url for authentication
// Once authenticated, returns to the home page with a code which we use to get the current user
func authHandler(w http.ResponseWriter, r *http.Request) {
	ctx := appengine.NewContext(r)
	log.Infof(ctx, "Redirecting to SO login")
	auth_url := backend.AuthURL(r.Header["Referer"][0])
	header := w.Header()
	header.Add("Location", auth_url)
	w.WriteHeader(302)
}