// GetProfileData gather's the user's Linkedin profile data and returns it as a pointer to a LinkedinProfile struct.
// CAUTION: GetLoginURL must be called before this, as GetProfileData() has a state check.
GetProfileData gather's the user's Linkedin profile data and returns it as a pointer to a LinkedinProfile struct.
CAUTION: GetLoginURL must be called before this, as GetProfileData() has a state check.
// GetProfileData gather ' s the user ' s Linkedin profile data and returns it as a pointer to a LinkedinProfile struct . // CAUTION : GetLoginURL must be called before this as GetProfileData () has a state check .
func GetProfileData(w http.ResponseWriter, r *http.Request) (*LinkedinProfile, error) {
	if validState(r) == false {
		err := fmt.Errorf("State comparison failed")
		return &LinkedinProfile{}, err
	}
	params := r.URL.Query()
	tok, err := authConf.Exchange(oauth2.NoContext, params.Get("code"))
	if err != nil {
		return &LinkedinProfile{}, err
	}
	client := authConf.Client(oauth2.NoContext, tok)
	resp, err := client.Get(fullRequestURL)
	if err != nil {
		return &LinkedinProfile{}, err
	}
	data, _ := ioutil.ReadAll(resp.Body)
	defer resp.Body.Close()
	formattedData, err := parseJSON(string(data))
	if err != nil {
		return &LinkedinProfile{}, err
	}
	return formattedData, nil
}
func GetProfileData ( w http . ResponseWriter , r * http . Request ) ( * LinkedinProfile , error ) { if validState ( r ) == false { err := fmt . Errorf ( " " ) return & LinkedinProfile { } , err } params := r . URL . Query ( ) tok , err := authConf . Exchange ( oauth2 . NoContext , params . Get ( " " ) ) if err != nil { return & LinkedinProfile { } , err } client := authConf . Client ( oauth2 . NoContext , tok ) resp , err := client . Get ( fullRequestURL ) if err != nil { return & LinkedinProfile { } , err } data , _ := ioutil . ReadAll ( resp . Body ) defer resp . Body . Close ( ) formattedData , err := parseJSON ( string ( data ) ) if err != nil { return & LinkedinProfile { } , err } return formattedData , nil }
GetProfileData gather's the user's Linkedin profile data and returns it as a pointer to a LinkedinProfile struct.
GetProfileData gather ' s the user ' s Linkedin profile data and returns it as a pointer to a LinkedinProfile struct .
// Authenticate // Retrieve data // Store data to struct and return.