Skip to content

Commit

Permalink
simplify bitbucket.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
falcowinkler committed Jan 5, 2025
1 parent 43f8434 commit 24fd469
Showing 1 changed file with 3 additions and 32 deletions.
35 changes: 3 additions & 32 deletions packages/core/src/providers/bitbucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@ export interface BitbucketProfile {
* By default, Auth.js assumes that the Bitbucket provider is
* based on the [OAuth 2](https://www.rfc-editor.org/rfc/rfc6749.html) specification.
*
* #### Registration
*
* - [Login](https://bitbucket.org/)
* - [Workspaces](https://bitbucket.org/account/workspaces/)
* - Settings > Workspace settings > OAuth consumers > Add consumer
* Name: Auth.js,
* Description: Auth.js,
* Callback URL: https://example.com/api/auth/callback/bitbucket
* Permissions: Account: Read Email Write
* Click "Save"
* Copy the "Key" and "Secret" to your `.env.local` file.
*
* #### Resources
*
* - [Using OAuth on Bitbucket Cloud](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/)
Expand Down Expand Up @@ -110,37 +98,20 @@ export default function Bitbucket(
name: "Bitbucket",
type: "oauth",
authorization: {
url: `https://bitbucket.org/site/oauth2/authorize`,
url: "https://bitbucket.org/site/oauth2/authorize",
params: {
response_type: "code",
scope: "account",
},
},
token: {
url: "https://bitbucket.org/site/oauth2/access_token",
params: {
grant_type: "authorization_code",
},
},
userinfo: {
url: "https://api.bitbucket.org/2.0/user",
async request({ tokens, provider }) {
return await fetch(provider.userinfo?.url as URL, {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${tokens.access_token}`,
},
}).then((response) => response.json())
},
},
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,
}
},
issuer: "https://bitbucket.org",
options: config,
style: {
text: "#fff",
Expand Down

0 comments on commit 24fd469

Please sign in to comment.