func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
	s := session.(*Session)
	shop := goth.User{
		AccessToken: s.AccessToken,
		Provider:    p.Name(),
	}

	if shop.AccessToken == "" {
		// Data is not yet retrieved since accessToken is still empty.
		return shop, fmt.Errorf("%s cannot get shop information without accessToken", p.providerName)
	}

	// Build the request.
	req, err := http.NewRequest("GET", fmt.Sprintf("https://%s.%s", p.shopName, endpointProfile), nil)
	if err != nil {
		return shop, err
	}
	req.Header.Set("X-Shopify-Access-Token", s.AccessToken)

	// Execute the request.
	resp, err := p.Client().Do(req)
	if err != nil {
		if resp != nil {
			resp.Body.Close()
		}
		return shop, err
	}
	defer resp.Body.Close()

	// Check our response status.
	if resp.StatusCode != http.StatusOK {
		return shop, fmt.Errorf("%s responded with a %d trying to fetch shop information", p.providerName, resp.StatusCode)
	}

	// Parse response.
	return shop, shopFromReader(resp.Body, &shop)
}
// FetchUser will go to Shopify and access basic information about the user.
FetchUser will go to Shopify and access basic information about the user.
// FetchUser will go to Shopify and access basic information about the user .
func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
	s := session.(*Session)
	shop := goth.User{
		AccessToken: s.AccessToken,
		Provider:    p.Name(),
	}
	if shop.AccessToken == "" {
		return shop, fmt.Errorf("%s cannot get shop information without accessToken", p.providerName)
	}
	req, err := http.NewRequest("GET", fmt.Sprintf("https://%s.%s", p.shopName, endpointProfile), nil)
	if err != nil {
		return shop, err
	}
	req.Header.Set("X-Shopify-Access-Token", s.AccessToken)
	resp, err := p.Client().Do(req)
	if err != nil {
		if resp != nil {
			resp.Body.Close()
		}
		return shop, err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return shop, fmt.Errorf("%s responded with a %d trying to fetch shop information", p.providerName, resp.StatusCode)
	}
	return shop, shopFromReader(resp.Body, &shop)
}
func ( p * Provider ) FetchUser ( session goth . Session ) ( goth . User , error ) { s := session . ( * Session ) shop := goth . User { AccessToken : s . AccessToken , Provider : p . Name ( ) , } if shop . AccessToken == " " { return shop , fmt . Errorf ( " " , p . providerName ) } req , err := http . NewRequest ( " " , fmt . Sprintf ( " " , p . shopName , endpointProfile ) , nil ) if err != nil { return shop , err } req . Header . Set ( " " , s . AccessToken ) resp , err := p . Client ( ) . Do ( req ) if err != nil { if resp != nil { resp . Body . Close ( ) } return shop , err } defer resp . Body . Close ( ) if resp . StatusCode != http . StatusOK { return shop , fmt . Errorf ( " " , p . providerName , resp . StatusCode ) } return shop , shopFromReader ( resp . Body , & shop ) }
FetchUser will go to Shopify and access basic information about the user.
FetchUser will go to Shopify and access basic information about the user .
// Data is not yet retrieved since accessToken is still empty. // Build the request. // Execute the request. // Check our response status. // Parse response.