func (p *MyUsaProvider) GetEmailAddress(s *SessionState) (string, error) { req, err := http.NewRequest("GET", p.ProfileURL.String()+"?access_token="+s.AccessToken, nil) if err != nil { log.Printf("failed building request %s", err) return "", err } json, err := api.Request(req) if err != nil { log.Printf("failed making request %s", err) return "", err } return json.Get("email").String() }
func (p *LinkedInProvider) GetEmailAddress(s *SessionState) (string, error) { if s.AccessToken == "" { return "", errors.New("missing access token") } req, err := http.NewRequest("GET", p.ProfileURL.String()+"?format=json", nil) if err != nil { return "", err } req.Header = getLinkedInHeader(s.AccessToken) json, err := api.Request(req) if err != nil { return "", err } email, err := json.String() if err != nil { return "", err } return email, nil }