diff --git a/.github/ISSUE_TEMPLATE/2_bug_provider.yml b/.github/ISSUE_TEMPLATE/2_bug_provider.yml index 1ee4409a23..1f732177e6 100644 --- a/.github/ISSUE_TEMPLATE/2_bug_provider.yml +++ b/.github/ISSUE_TEMPLATE/2_bug_provider.yml @@ -52,6 +52,7 @@ body: - "Figma" - "Foursquare" - "Freshbooks" + - "Frontegg" - "FusionAuth" - "GitHub" - "GitLab" @@ -60,8 +61,8 @@ body: - "Identity Server 4" - "Instagram" - "Kakao" - - "Frontegg" - "Keycloak" + - "Kick" - "Kinde" - "Line" - "LinkedIn" diff --git a/docs/pages/data/manifest.json b/docs/pages/data/manifest.json index 7fef03e029..e13e7f7406 100644 --- a/docs/pages/data/manifest.json +++ b/docs/pages/data/manifest.json @@ -83,6 +83,7 @@ "identity-server4": "IdentityServer4", "instagram": "Instagram", "kakao": "Kakao", + "kick": "Kick", "kinde": "Kinde", "line": "LINE", "linkedin": "LinkedIn", @@ -156,4 +157,4 @@ "passage", "ping-id" ] -} +} \ No newline at end of file diff --git a/docs/public/img/providers/kick.png b/docs/public/img/providers/kick.png new file mode 100644 index 0000000000..7f500c21f7 Binary files /dev/null and b/docs/public/img/providers/kick.png differ diff --git a/packages/core/src/providers/kick.ts b/packages/core/src/providers/kick.ts new file mode 100644 index 0000000000..dde3cec887 --- /dev/null +++ b/packages/core/src/providers/kick.ts @@ -0,0 +1,135 @@ +/** + *
+ * Built-in Kick integration. + * + * + * + *
+ * + * @module providers/kick + */ + +import type { OAuthConfig, OAuthUserConfig } from "./index.js" + +// https://docs.kick.com/apis/users#get-users +export interface KickProfile { + data: Array<{ + /** + * Unique identifier for the user. + */ + user_id: number + /** + * Display name of the user. + */ + name: string + /** + * Email address of the user. + */ + email: string + /** + * URL of the user's profile picture. + */ + profile_picture: string + }> + /** + * Response message from the API. + */ + message: string +} + +/** + * Add Kick login to your page. + * + * ### Setup + * + * #### Callback URL + * ``` + * https://example.com/api/auth/callback/kick + * ``` + * + * #### Configuration + *```ts + * import { Auth } from "@auth/core" + * import Kick from "@auth/core/providers/kick" + * + * const request = new Request(origin) + * const response = await Auth(request, { + * providers: [ + * Kick({ + * clientId: KICK_CLIENT_ID, + * clientSecret: KICK_CLIENT_SECRET, + * }), + * ], + * }) + * ``` + * + * ### Scopes + * + * The Kick provider uses the `user:read` scope by default to access basic user information. + * For a complete list of available scopes and their descriptions, see the + * [Kick Scopes documentation](https://docs.kick.com/getting-started/scopes). + * + * ### Resources + * + * - [Kick Developer documentation](https://docs.kick.com/) + * - [Create an OAuth application](https://dev.kick.com/) + * + * ### Notes + * + * By default, Auth.js assumes that the Kick provider is + * based on the [OAuth 2.0](https://tools.ietf.org/html/rfc6749) specification. + * + * :::tip + * + * The Kick provider comes with a [default configuration](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/kick.ts). + * To override the defaults for your use case, check out [customizing a built-in OAuth provider](https://authjs.dev/guides/configuring-oauth-providers). + * + * ::: + * + * :::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 Kick( + options: OAuthUserConfig +): OAuthConfig { + return { + id: "kick", + name: "Kick", + type: "oauth", + client: { + token_endpoint_auth_method: "client_secret_post", + }, + authorization: { + url: "https://id.kick.com/oauth/authorize", + params: { + response_type: "code", + scope: "user:read", + }, + }, + token: "https://id.kick.com/oauth/token", + userinfo: "https://api.kick.com/public/v1/users", + checks: ["pkce", "state"], + profile(profile) { + // Extract user data from the API response structure + const userData = profile.data[0]! + return { + id: String(userData.user_id), + name: userData.name, + email: userData.email, + image: userData.profile_picture, + } + }, + style: { + bg: "#53fc18", + text: "#000", + }, + options, + } +}