Documentation
¶
Index ¶
Constants ¶
const ( // AppAuthorizationURL is the GitHub page where users review the // authorization of the sourcetool OAuth app and grant it (or request) // access to their organizations. AppAuthorizationURL = "https://github.com/settings/connections/applications/" + oauthClientID )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
func New ¶
func New() *Authenticator
NewGitHubApp creates a new GitHub OAuth application for device flow
func (*Authenticator) Authenticate ¶
func (a *Authenticator) Authenticate(ctx context.Context) error
Authenticate performs the complete device flow authentication in the user's terminal and web browser
func (*Authenticator) GetGitHubClient ¶
func (a *Authenticator) GetGitHubClient() (*github.Client, error)
GetGitHubClient returns a GitHub client preconfigured with the logged-in token.
func (*Authenticator) ReadToken ¶
func (a *Authenticator) ReadToken() (string, error)
ReadToken reads the persisted token and returns it
func (*Authenticator) UsesEnvironmentToken ¶ added in v0.7.3
func (a *Authenticator) UsesEnvironmentToken() bool
UsesEnvironmentToken returns true when the authenticator is not using a token issued to the sourcetool app (stored by Authenticate) but one supplied by the user in the GITHUB_TOKEN environment variable.
type DeviceCodeResponse ¶
type DeviceCodeResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
DeviceCodeResponse models the github device code response