Skip to content

Commit 08fd0f8

Browse files
committed
simplify bitbucket.ts
1 parent 8ac8319 commit 08fd0f8

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

packages/core/src/providers/bitbucket.ts

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,6 @@ export interface BitbucketProfile {
6767
* By default, Auth.js assumes that the Bitbucket provider is
6868
* based on the [OAuth 2](https://www.rfc-editor.org/rfc/rfc6749.html) specification.
6969
*
70-
* #### Registration
71-
*
72-
* - [Login](https://bitbucket.org/)
73-
* - [Workspaces](https://bitbucket.org/account/workspaces/)
74-
* - Settings > Workspace settings > OAuth consumers > Add consumer
75-
* Name: Auth.js,
76-
* Description: Auth.js,
77-
* Callback URL: https://example.com/api/auth/callback/bitbucket
78-
* Permissions: Account: Read Email Write
79-
* Click "Save"
80-
* Copy the "Key" and "Secret" to your `.env.local` file.
81-
*
8270
* #### Resources
8371
*
8472
* - [Using OAuth on Bitbucket Cloud](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/)
@@ -110,29 +98,14 @@ export default function Bitbucket(
11098
name: "Bitbucket",
11199
type: "oauth",
112100
authorization: {
113-
url: `https://bitbucket.org/site/oauth2/authorize`,
101+
url: "https://bitbucket.org/site/oauth2/authorize",
114102
params: {
115103
response_type: "code",
116104
scope: "account",
117105
},
118106
},
119-
token: {
120-
url: "https://bitbucket.org/site/oauth2/access_token",
121-
params: {
122-
grant_type: "authorization_code",
123-
},
124-
},
125-
userinfo: {
126-
url: "https://api.bitbucket.org/2.0/user",
127-
async request({ tokens, provider }) {
128-
return await fetch(provider.userinfo?.url as URL, {
129-
headers: {
130-
"Content-Type": "application/json",
131-
Authorization: `Bearer ${tokens.access_token}`,
132-
},
133-
}).then((response) => response.json())
134-
},
135-
},
107+
token: "https://bitbucket.org/site/oauth2/access_token",
108+
userinfo: "https://api.bitbucket.org/2.0/user",
136109
profile(profile) {
137110
return {
138111
name: profile.display_name ?? profile.username,

0 commit comments

Comments
 (0)