Discover Packages
github.com/fantasticrabbit/authcu
package
module
Version:
v0.0.2
Opens a new window with list of versions in this module.
Published: Sep 24, 2021
License: Apache-2.0
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
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
Install golang
Import package into your Go project:
import (
"fmt"
"os"
"github.com/fantasticrabbit/goauth_clickup"
)
Create new application in Clickup > Settings > Integrations > Clickup API. Define the redirect URL, i.e. http://localhost:4321
for example below.
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
Use the provided function: getAccessToken(clientID, clientSecret, redirectURL)
which returns variable AccessToken
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)
Expand ▾
Collapse ▴
Documentation
¶
func GetCUToken(clientID, clientSecret, redirectURL string ) (accessToken string )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.