code: func (c *Client) SetupAuth() error {
  	if c.noExtConfig {
  		if c.authMode != nil {
  			if _, ok := c.authMode.(*auth.None); !ok {
  				return nil
  			}
  		}
  		return errors.New("client: noExtConfig set; auth should not be configured from config or env vars")
  	}
  	// env var takes precedence, but only if we're in dev mode or on android.
  	// Too risky otherwise.
  	if android.OnAndroid() ||
  		env.IsDev() ||
  		configDisabled {
  		authMode, err := auth.FromEnv()
  		if err == nil {
  			c.authMode = authMode
  			return nil
  		}
  		if err != auth.ErrNoAuth {
  			return fmt.Errorf("Could not set up auth from env var CAMLI_AUTH: %v", err)
  		}
  	}
  	if c.server == "" {
  		return fmt.Errorf("no server defined for this client: can not set up auth")
  	}
  	authConf := serverAuth(c.server)
  	if authConf == "" {
  		c.authErr = fmt.Errorf("could not find auth key for server %q in config, defaulting to no auth", c.server)
  		c.authMode = auth.None{}
  		return nil
  	}
  	var err error
  	c.authMode, err = auth.FromConfig(authConf)
  	return err
  }
docs: // SetupAuth sets the client's authMode. It tries from the environment first if we're on android or in dev mode, and then from the client configuration.