diff --git a/.github/ISSUE_TEMPLATE/2_bug_provider.yml b/.github/ISSUE_TEMPLATE/2_bug_provider.yml
index 406084ea8d..4545ebbf3e 100644
--- a/.github/ISSUE_TEMPLATE/2_bug_provider.yml
+++ b/.github/ISSUE_TEMPLATE/2_bug_provider.yml
@@ -34,6 +34,7 @@ body:
- "Azure DevOps"
- "Battlenet"
- "Beyond Identity"
+ - "Bitbucket"
- "Box"
- "Bungie"
- "ClickUp"
diff --git a/docs/pages/data/manifest.json b/docs/pages/data/manifest.json
index 6915a8c969..50fb339f1c 100644
--- a/docs/pages/data/manifest.json
+++ b/docs/pages/data/manifest.json
@@ -60,6 +60,7 @@
"azure-devops": "Azure DevOps",
"battlenet": "Battle.net",
"beyondidentity": "Beyond Identity",
+ "bitbucket": "Bitbucket",
"box": "Box",
"boxyhq-saml": "BoxyHQ SAML",
"bungie": "Bungie",
diff --git a/docs/pages/getting-started/providers/bitbucket.mdx b/docs/pages/getting-started/providers/bitbucket.mdx
new file mode 100644
index 0000000000..0406e9f827
--- /dev/null
+++ b/docs/pages/getting-started/providers/bitbucket.mdx
@@ -0,0 +1,131 @@
+import { Callout } from "nextra/components"
+import { Code } from "@/components/Code"
+
+
+
+# Bitbucket Provider
+
+## Resources
+
+- [Using OAuth on Bitbucket Cloud](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/)
+- [Bitbucket REST API Authentication](https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication)
+- [Bitbucket REST API Users](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-group-users)
+
+## Setup
+
+### Callback URL
+
+
+
+
+```bash
+https://example.com/api/auth/callback/bitbucket
+```
+
+
+
+
+```bash
+https://example.com/auth/callback/bitbucket
+```
+
+
+
+
+```bash
+https://example.com/auth/callback/bitbucket
+```
+
+
+
+
+### Environment Variables
+
+
+
+
+```bash filename=".env.local"
+AUTH_BITBUCKET_ID
+AUTH_BITBUCKET_SECRET
+```
+
+
+
+
+```bash filename=".env"
+AUTH_BITBUCKET_ID
+AUTH_BITBUCKET_SECRET
+```
+
+
+
+
+```bash filename=".env"
+AUTH_BITBUCKET_ID
+AUTH_BITBUCKET_SECRET
+```
+
+
+
+
+
+```bash filename=".env"
+AUTH_BITBUCKET_ID
+AUTH_BITBUCKET_SECRET
+```
+
+
+
+
+### Configuration
+
+
+
+
+```ts filename="@/auth.ts"
+import NextAuth from "next-auth"
+import Bitbucket from "next-auth/providers/bitbucket"
+
+export const { handlers, auth, signIn, signOut } = NextAuth({
+ providers: [Bitbucket],
+})
+```
+
+
+
+
+```ts filename="/src/routes/plugin@auth.ts"
+import { QwikAuth$ } from "@auth/qwik"
+import Bitbucket from "@auth/qwik/providers/bitbucket"
+
+export const { onRequest, useSession, useSignIn, useSignOut } = QwikAuth$(
+ () => ({
+ providers: [Bitbucket],
+ })
+)
+```
+
+
+
+
+```ts filename="/src/auth.ts"
+import { SvelteKitAuth } from "@auth/sveltekit"
+import Bitbucket from "@auth/sveltekit/providers/bitbucket"
+
+export const { handle, signIn, signOut } = SvelteKitAuth({
+ providers: [Bitbucket],
+})
+```
+
+
+
+
+```ts filename="/src/app.ts"
+import { ExpressAuth } from "@auth/express"
+import Bitbucket from "@auth/express/providers/bitbucket"
+
+app.use("/auth/*", ExpressAuth({ providers: [Bitbucket] }))
+```
+
+
+
diff --git a/docs/public/img/providers/bitbucket.svg b/docs/public/img/providers/bitbucket.svg
new file mode 100644
index 0000000000..7493a80e16
--- /dev/null
+++ b/docs/public/img/providers/bitbucket.svg
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/packages/core/src/providers/bitbucket.ts b/packages/core/src/providers/bitbucket.ts
new file mode 100644
index 0000000000..dfb1d99e65
--- /dev/null
+++ b/packages/core/src/providers/bitbucket.ts
@@ -0,0 +1,122 @@
+/**
+ *
+ *
Built-in Bitbucket integration.
+ *
+ *
+ *
+ *
+ *
+ * @module providers/bitbucket
+ */
+
+import { OAuthConfig, OAuthUserConfig } from "./index.js"
+
+type LiteralUnion = T | (U & Record)
+
+/**
+ * @see https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-user-get
+ */
+export interface BitbucketProfile {
+ display_name: string
+ links: Record<
+ LiteralUnion<
+ "self" | "avatar" | "repositories" | "snippets" | "html" | "hooks"
+ >,
+ { href?: string }
+ >
+ created_on: string
+ type: string
+ uuid: string
+ has_2fa_enabled: boolean | null
+ username: string
+ is_staff: boolean
+ account_id: string
+ nickname: string
+ account_status: string
+ location: string | null
+}
+
+/**
+ *
+ * ### Setup
+ *
+ * #### Callback URL
+ *
+ * ```ts
+ * https://example.com/api/auth/callback/bitbucket
+ * ```
+ *
+ * #### Configuration
+ *
+ * ```ts
+ * import { Auth } from "@auth/core"
+ * import Bitbucket from "@auth/core/providers/bitbucket"
+ *
+ * const request = new Request(origin)
+ * const response = await Auth(request, {
+ * providers: [
+ * Bitbucket({
+ * clientId: process.env.BITBUCKET_CLIENT_ID,
+ * clientSecret: process.env.BITBUCKET_CLIENT_SECRET,
+ * })
+ * ],
+ * })
+ * ```
+ *
+ * #### Resources
+ *
+ * - [Using OAuth on Bitbucket Cloud](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/)
+ * - [Bitbucket REST API Authentication](https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication)
+ * - [Bitbucket REST API Users](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-group-users)
+ *
+ * #### Notes
+ *
+ * By default, Auth.js assumes that the Bitbucket provider is
+ * based on the [OAuth 2](https://www.rfc-editor.org/rfc/rfc6749.html) specification.
+ *
+ * :::tip
+ *
+ * The Bitbucket provider comes with a [default configuration](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/bitbucket.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 Bitbucket(
+ options: OAuthUserConfig
+): OAuthConfig {
+ return {
+ id: "bitbucket",
+ name: "Bitbucket",
+ type: "oauth",
+ authorization: {
+ url: "https://bitbucket.org/site/oauth2/authorize",
+ params: {
+ scope: "account",
+ },
+ },
+ token: "https://bitbucket.org/site/oauth2/access_token",
+ userinfo: "https://api.bitbucket.org/2.0/user",
+ profile(profile) {
+ return {
+ name: profile.display_name ?? profile.username,
+ id: profile.account_id,
+ image: profile.links.avatar?.href,
+ }
+ },
+ options,
+ style: {
+ text: "#fff",
+ bg: "#205081",
+ },
+ }
+}