Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) AddSession(tok *session.Token) error
- func (c *Client) GetSession(ctx context.Context) (*session.Token, error)
- func (c *Client) GetSessions() ([]refreshableTokenSource, error)
- func (c *Client) LoginFlow() (*session.Token, error)
- func (c *Client) LoginFlowIfNeeded(ctx context.Context) (*session.Token, error)
- func (c *Client) LoginFlowIfNeededForOrg(ctx context.Context, orgID string) (*session.Token, error)
- func (c *Client) LogoutFlow() error
- func (c *Client) RevokeSession() error
Constants ¶
This section is empty.
Variables ¶
var ErrNotLoggedIn = fmt.Errorf("not logged in")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetSession ¶
GetSession returns the current valid session token, if any. If token is expired, it will attempt to refresh it. If no token is found, or is unable to be refreshed, it will return error.
func (*Client) GetSessions ¶
GetSessions returns all session tokens as refreshableTokenSource. This means that they may not be valid or even refreshable. Callers can use Token() to refresh the token if needed. Even if Token() fails to refresh, it still returns the token, so callers can use the expired data if they want. This allows callers to list all sessions, even if they are expired. Callers can use Peek() to inspect token data without refreshing.
func (*Client) LoginFlowIfNeeded ¶
func (*Client) LoginFlowIfNeededForOrg ¶
func (c *Client) LoginFlowIfNeededForOrg( ctx context.Context, orgID string, ) (*session.Token, error)
LoginFlowIfNeededForOrg returns the current valid session token for a given org and prompts to log in if needed. Note: I'm not sure this is best API. Currently evolving