identity.go raw

   1  package internal
   2  
   3  import (
   4  	"context"
   5  	"net/http"
   6  
   7  	"golang.org/x/oauth2/clientcredentials"
   8  )
   9  
  10  const defaultAuthURL = "https://gateway.stackpath.com/identity/v1/oauth2/token"
  11  
  12  func CreateOAuthClient(ctx context.Context, clientID, clientSecret string) *http.Client {
  13  	config := &clientcredentials.Config{
  14  		TokenURL:     defaultAuthURL,
  15  		ClientID:     clientID,
  16  		ClientSecret: clientSecret,
  17  	}
  18  
  19  	return config.Client(ctx)
  20  }
  21