authcu

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

Purpose

Package provides simplified OAuth 2.0 key exchange for Clickup API v2. Please note that Clickup's access keys do not expire, and there is no refresh token implementation.

Attribution

Authentication and Go server/client code largely based on Laura Vuorenoja's kaneli application, and corresponding tutorial on dev.to

Setup to run from code

  1. Install golang
  2. Import package into your Go project:
    import (
        "fmt"
        "os"
    
        "github.com/fantasticrabbit/goauth_clickup"
    )
    
  3. Create new application in Clickup > Settings > Integrations > Clickup API. Define the redirect URL, i.e. http://localhost:4321 for example below.
  4. Set the client id and secret from the Clickup API App UI as env variables and define in your Go project:
var (
	clientID     = os.Getenv("CLICKUP_CLIENT_ID")
	clientSecret = os.Getenv("CLICKUP_CLIENT_SECRET")
	redirectURL  = "https://localhost:4321"
)

Usage

  1. Use the provided function: getAccessToken(clientID, clientSecret, redirectURL) which returns variable AccessToken
  2. To request data from ClickUp API provide request with following header data to the appropriate Clickup API URL:
    req.Header.Add("Authorization", tokenValue)
    req.Header.Add("Content-Type", "application/json")
    req.Header.Add("X-API-Key", clientID)
    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCUToken

func GetCUToken(clientID, clientSecret, redirectURL string) (accessToken string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL