Documentation ¶
Index ¶
- Variables
- func Browser(ctx context.Context, workspace string, opt ...Option) (string, []*http.Cookie, error)
- func Headless(ctx context.Context, workspace, email, password string, opt ...Option) (string, []*http.Cookie, error)
- func SimpleChallengeFn(email string) (int, error)
- type ErrBadWorkspace
- type ErrBrowser
- type Logger
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidCredentials indicates that the credentials were invalid. ErrInvalidCredentials = errors.New("invalid credentials") // ErrLoginError indicates that some error of unknown nature occurred // during login. ErrLoginError = errors.New("slack reported an error during login") // ErrWorkspaceNotFound indicates that the workspace name was invalid. ErrWorkspaceNotFound = errors.New("workspace not found") )
Functions ¶
func Headless ¶
func Headless(ctx context.Context, workspace, email, password string, opt ...Option) (string, []*http.Cookie, error)
Headless logs the user in headlessly, without opening the browser UI. It is only suitable for user/email login method, as it does not require any additional user interaction.
func SimpleChallengeFn ¶
SimpleChallengeFn is a simple challenge function that reads a single integer from stdin. It is used as a default challenge function when none is provided.
Types ¶
type ErrBadWorkspace ¶
type ErrBadWorkspace struct {
Name string
}
ErrBadWorkspace is returned when the workspace name is invalid.
func (ErrBadWorkspace) Error ¶
func (e ErrBadWorkspace) Error() string
type ErrBrowser ¶
ErrBrowser indicates the error with browser interaction.
func (ErrBrowser) Error ¶
func (e ErrBrowser) Error() string
type Logger ¶
type Logger interface { // Debug logs a debug message. Debug(msg string, keyvals ...interface{}) }
type Option ¶
type Option func(*options)
func WithChallengeFunc ¶
WithChallengeFunc sets the function that is called when slack does not recognise the browser and challenges the user with a code sent to email. All the function has to do is to accept the user input and return the code.
See SimpleChallengeFn(#SimpleChallengeFn) for an example.
func WithCookie ¶
WithCookie adds a cookie to the request.
func WithLogger ¶
func WithNoConsentPrompt ¶
func WithNoConsentPrompt() Option
WithNoConsentPrompt adds a cookie that disables the Cookie Consent banner.