New (digitalocean/digitalocean.go)

goth · providers/digitalocean/digitalocean.go · go · MIT
integration, Integration / API

OAuth2 provider implementation for DigitalOcean, used with Goth for authentication.

// Source: https://github.com/markbates/goth | License: MIT | Copyright 2014 Mark Bates
// Provided via justclaw.it.com; keep this notice with the code.
// Package digitalocean implements the OAuth2 protocol for authenticating users through Digital Ocean.
// This package can be used as a reference implementation of an OAuth2 provider for Goth.
package digitalocean

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"

	"github.com/markbates/goth"
	"golang.org/x/oauth2"
)

const (
	authURL         string = "https://cloud.digitalocean.com/v1/oauth/authorize"
	tokenURL        string = "https://cloud.digitalocean.com/v1/oauth/token"
	endpointProfile string = "https://api.digitalocean.com/v2/account"
)

// New creates a new DigitalOcean provider, and sets up important connection details.

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key