// overrideAuth specifies the token to authenticate the request with. token == "" is not allowed func overrideAuth(token *string, req *client.Request) (*client.Request, error) { if token != nil { if len(*token) == 0 { return nil, errors.New("impersonating token may not be empty") } req.SetHeader("Authorization", fmt.Sprintf("Bearer %s", *token)) } return req, nil }