Documentation
¶
Overview ¶
Package slack implements the Slack API provider.
Index ¶
Constants ¶
const ( ID = "slack" ClientIdKey = "id" ClientSecretKey = "secret" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IdentityResponse ¶
type IdentityResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
User IdentityUser `json:"user"`
Team IdentityTeam `json:"team"`
}
IdentityResponse represents the Slack users.identity API response.
type IdentityTeam ¶
IdentityTeam represents the team in the identity response.
type IdentityUser ¶
type IdentityUser struct {
Name string `json:"name"`
ID string `json:"id"`
Image48 string `json:"image_48"`
}
IdentityUser represents the user in the identity response.
type OAuthAuthedUser ¶
type OAuthAuthedUser struct {
ID string `json:"id"`
Scope string `json:"scope"`
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
RefreshToken string `json:"refresh_token,omitempty"`
}
OAuthAuthedUser represents the authed_user in the OAuth response.
type OAuthV2AccessResponse ¶
type OAuthV2AccessResponse struct {
OK bool `json:"ok"`
Error string `json:"error,omitempty"`
AuthedUser OAuthAuthedUser `json:"authed_user"`
Team OAuthTeam `json:"team"`
}
OAuthV2AccessResponse represents the Slack oauth.v2.access API response.
type Slack ¶
type Slack struct {
// contains filtered or unexported fields
}
Slack implements the OAuthProvider interface for Slack's OAuth v2 flow using the Sign in with Slack (identity.*) scopes.
func GetClient ¶
func GetClient() *Slack
GetClient reads OAuth provider config and returns a new Slack client suitable for OAuth authorization flows.
func (*Slack) GetAccessToken ¶
GetAccessToken implements the OAuthProvider interface. It exchanges the authorization code from the callback for a user access token and returns the token data as a typed OAuthToken.
func (*Slack) GetAuthorizeURL ¶
GetAuthorizeURL returns the Slack OAuth v2 authorization URL with identity.basic and identity.avatar user scopes. The state parameter is included for CSRF protection.
func (*Slack) GetIdentity ¶
func (v *Slack) GetIdentity() (*IdentityResponse, error)
GetIdentity uses the access token to fetch the authenticated user's identity from the Slack users.identity API.
func (*Slack) RefreshAccessToken ¶
func (v *Slack) RefreshAccessToken(ctx context.Context, refreshToken string) (*providers.OAuthToken, error)
RefreshAccessToken implements OAuthRefresher for Slack. Slack supports token rotation for certain scopes via the refresh_token grant.