Documentation
¶
Overview ¶
Package doauth is the DigitalOcean OAuth2 client: authorize URL, code exchange, refresh and revoke.
Index ¶
- Constants
- Variables
- func Challenge(verifier string) string
- func NewVerifier() (string, error)
- type Client
- func (c Client) AuthorizeURL(clientID, redirectURI, state, challenge string) string
- func (c Client) Exchange(ctx context.Context, clientID, secret, redirectURI, code, verifier string) (Tokens, error)
- func (c Client) Refresh(ctx context.Context, clientID, secret, refresh string) (Tokens, error)
- func (c Client) Revoke(ctx context.Context, token string) error
- type Tokens
Constants ¶
View Source
const DefaultBase = "https://cloud.digitalocean.com"
DefaultBase is the DigitalOcean cloud host that serves the OAuth endpoints.
View Source
const Scope = "read write"
Scope asks for read and write so the control plane can create and delete droplets.
Variables ¶
View Source
var ErrRejected = errors.New("doauth: provider rejected the grant")
ErrRejected means DigitalOcean refused the grant (bad code, spent or revoked refresh token).
Functions ¶
func NewVerifier ¶
NewVerifier returns an RFC 7636 verifier from 32 random bytes.
Types ¶
type Client ¶
Client talks to one DigitalOcean OAuth host. Zero Base uses DefaultBase.
func (Client) AuthorizeURL ¶
AuthorizeURL is the page the operator's browser must open.
func (Client) Exchange ¶
func (c Client) Exchange(ctx context.Context, clientID, secret, redirectURI, code, verifier string) (Tokens, error)
Exchange trades an authorization code for tokens.
Click to show internal directories.
Click to hide internal directories.