code: func NewTokenSession(host, user, passwd, loginProviderName string, configOptions *ConfigOptions) (b *BigIP, err error) {
  	type authReq struct {
  		Username          string `json:"username"`
  		Password          string `json:"password"`
  		LoginProviderName string `json:"loginProviderName"`
  	}
  	type authResp struct {
  		Token struct {
  			Token string
  		}
  	}
  
  	auth := authReq{
  		user,
  		passwd,
  		loginProviderName,
  	}
  
  	marshalJSON, err := json.Marshal(auth)
  	if err != nil {
  		return
  	}
  
  	req := &APIRequest{
  		Method:      "post",
  		URL:         "mgmt/shared/authn/login",
  		Body:        string(marshalJSON),
  		ContentType: "application/json",
  	}
  
  	b = NewSession(host, user, passwd, configOptions)
  	resp, err := b.APICall(req)
  	if err != nil {
  		return
  	}
  
  	if resp == nil {
  		err = fmt.Errorf("unable to acquire authentication token")
  		return
  	}
  
  	var aresp authResp
  	err = json.Unmarshal(resp, &aresp)
  	if err != nil {
  		return
  	}
  
  	if aresp.Token.Token == "" {
  		err = fmt.Errorf("unable to acquire authentication token")
  		return
  	}
  
  	b.Token = aresp.Token.Token
  
  	return
  }
docs: // NewTokenSession sets up our connection to the BIG-IP system, and
  // instructs the session to use token authentication instead of Basic
  // Auth. This is required when using an external authentication
  // provider, such as Radius or Active Directory. loginProviderName is
  // probably "tmos" but your environment may vary.