x/auth/user.go
Colin Henry 6e60671cfd WIP
2020-05-20 23:18:58 -07:00

29 lines
746 B
Go
Executable File

package auth
import (
"net/http"
jchenry_http "github.com/jchenry/jchenry/http"
)
func UserHandler(w http.ResponseWriter, r *http.Request) {
session, err := Store.Get(r, SessionName)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
jchenry_http.RenderTemplate(w, "user", session.Values["profile"])
}
type User struct {
ID string `json:"sub"`
Email string `json:"email"`
FirstName string `json:"given_name"`
LastName string `json:"family_name"`
Picture string `json:"picture"`
Nickname string `json:"nickname"`
Apps map[string]interface{} `json:"app_metadata,omitempty"`
}