// InitConfig initializes the config needed by the client.
// permissions is a string of all scopes desired by the user.
InitConfig initializes the config needed by the client.
permissions is a string of all scopes desired by the user.
// InitConfig initializes the config needed by the client . // permissions is a string of all scopes desired by the user .
func InitConfig(permissions []string, clientID string, clientSecret string, redirectURL string) {
	var isEmail, isBasic bool
	if permissions == nil {
		panic(fmt.Errorf("You must specify some scope to request"))
	}
	for _, elem := range permissions {
		if elem == "r_emailaddress" {
			isEmail = true
		} else if elem == "r_basicprofile" {
			isBasic = true
		}
		if validPermissions[elem] != true {
			panic(fmt.Errorf("All elements of permissions must be valid Linkedin permissions as specified in the API docs"))
		}
	}
	_, err := url.ParseRequestURI(redirectURL)
	if err != nil {
		panic(fmt.Errorf("redirectURL specified must be a valid FQDN. Please ensure you added https:// to the front"))
	}
	authConf = &oauth2.Config{ClientID: clientID,
		ClientSecret: clientSecret,
		Endpoint:     linkedin.Endpoint,
		RedirectURL:  redirectURL,
		Scopes:       permissions,
	}
	if isEmail && isBasic {
		requestedURL = fullRequestURL
	} else if isBasic {
		requestedURL = basicRequestURL
	}
}
func InitConfig ( permissions [ ] string , clientID string , clientSecret string , redirectURL string ) { var isEmail , isBasic bool if permissions == nil { panic ( fmt . Errorf ( " " ) ) } for _ , elem := range permissions { if elem == " " { isEmail = true } else if elem == " " { isBasic = true } if validPermissions [ elem ] != true { panic ( fmt . Errorf ( " " ) ) } } _ , err := url . ParseRequestURI ( redirectURL ) if err != nil { panic ( fmt . Errorf ( " " ) ) } authConf = & oauth2 . Config { ClientID : clientID , ClientSecret : clientSecret , Endpoint : linkedin . Endpoint , RedirectURL : redirectURL , Scopes : permissions , } if isEmail && isBasic { requestedURL = fullRequestURL } else if isBasic { requestedURL = basicRequestURL } }
InitConfig initializes the config needed by the client.
InitConfig initializes the config needed by the client .