-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(providers): Click up provider (#8489)
* feat: click up provider created * docs: ClickUp documentation * Format --------- Co-authored-by: Antonio Basile <antoniobasile2@eng.it> Co-authored-by: Thang Vu <hi@thvu.dev>
- Loading branch information
1 parent
4f3241f
commit f3c64a8
Showing
5 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ body: | |
- "Beyond Identity" | ||
- "Box" | ||
- "Bungie" | ||
- "ClickUp" | ||
- "Cognito" | ||
- "Coinbase" | ||
- "Descope" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/** | ||
* <div style={{backgroundColor: "#24292f", display: "flex", justifyContent: "space-between", color: "#fff", padding: 16}}> | ||
* <span>Built-in <b>ClickUp</b> integration.</span> | ||
* <a href="https://clickup.com"> | ||
* <img style={{display: "block"}} src="https://authjs.dev/img/providers/click-up.svg" height="48" width="48"/> | ||
* </a> | ||
* </div> | ||
* | ||
* @module providers/ClickUp | ||
*/ | ||
|
||
import type { OAuthConfig, OAuthUserConfig } from "./index.js" | ||
|
||
/** @see [Get the authenticated user](https://clickup.com/api/clickupreference/operation/GetAuthorizedUser/)*/ | ||
export interface ClickUpProfile { | ||
user: { | ||
id: number | ||
username: string | ||
color: string | ||
profilePicture: string | ||
} | ||
} | ||
|
||
/** | ||
* Add ClickUp login to your page and make requests to [ClickUp APIs](https://clickup.com/api/). | ||
* | ||
* ### Setup | ||
* | ||
* #### Callback URL | ||
* ``` | ||
* https://example.com/api/auth/callback/clickup | ||
* ``` | ||
* | ||
* #### Configuration | ||
* ```ts | ||
* import { Auth } from "@auth/core" | ||
* import ClickUp from "@auth/core/providers/click-up" | ||
* | ||
* const request = new Request(origin) | ||
* const response = await Auth(request, { | ||
* providers: [ClickUp({ clientId: CLICKUP_CLIENT_ID, clientSecret: CLICKUP_CLIENT_SECRET })], | ||
* }) | ||
* ``` | ||
* | ||
* ### Resources | ||
* | ||
* - [ClickUp - Authorizing OAuth Apps](https://clickup.com/api/developer-portal/authentication#oauth-flow) | ||
* - [Source code](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/click-up.ts) | ||
* | ||
* ### Notes | ||
* | ||
* By default, Auth.js assumes that the ClickUp provider is | ||
* based on the [OAuth 2](https://www.rfc-editor.org/rfc/rfc6749.html) specification. | ||
* | ||
* :::tip | ||
* | ||
* The ClickUp provider comes with a [default configuration](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/click-up.ts). | ||
* To override the defaults for your use case, check out [customizing a built-in OAuth provider](https://authjs.dev/guides/providers/custom-provider#override-default-options). | ||
* | ||
* ::: | ||
* | ||
* :::info **Disclaimer** | ||
* | ||
* If you think you found a bug in the default configuration, you can [open an issue](https://authjs.dev/new/provider-issue). | ||
* | ||
* Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from | ||
* the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, | ||
* we might not pursue a resolution. You can ask for more help in [Discussions](https://authjs.dev/new/github-discussions). | ||
* | ||
* ::: | ||
*/ | ||
export default function ClickUp( | ||
config: OAuthUserConfig<ClickUpProfile> | ||
): OAuthConfig<ClickUpProfile> { | ||
return { | ||
id: "clickup", | ||
name: "ClickUp", | ||
type: "oauth", | ||
authorization: "https://app.clickup.com/api", | ||
token: "https://api.clickup.com/api/v2/oauth/token", | ||
userinfo: "https://api.clickup.com/api/v2/user", | ||
clientId: config.clientId, | ||
clientSecret: config.clientSecret, | ||
checks: ["state"], | ||
profile: (profile: ClickUpProfile) => { | ||
return { | ||
id: profile.user.id.toString(), | ||
name: profile.user.username, | ||
profilePicture: profile.user.profilePicture, | ||
color: profile.user.color, | ||
} | ||
}, | ||
style: { | ||
logo: "/click-up.svg", | ||
logoDark: "/click-up.svg", | ||
bg: "#fff", | ||
bgDark: "#24292f", | ||
text: "#000", | ||
textDark: "#fff", | ||
}, | ||
options: config, | ||
} | ||
} |
f3c64a8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
auth-docs – ./docs
next-auth-docs-m1mt.vercel.app
auth-docs-git-main-authjs.vercel.app
adapters.authjs.dev
warnings.authjs.dev
www.authjs.dev
providers.authjs.dev
authjs.dev
sveltekit.authjs.dev
auth-docs-authjs.vercel.app
errors.authjs.dev