Socket
Socket
Sign inDemoInstall

bitbucket-api-v2

Package Overview
Dependencies
50
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.1 to 0.6.2

5

package.json
{
"name": "bitbucket-api-v2",
"version": "0.6.1",
"version": "0.6.2",
"description": "Wrapper for the BitBucket API v2, the version required to use OAuth2. Includes support for XHR requests.",

@@ -39,6 +39,6 @@ "homepage": "https://github.com/kristianmandrup/bitbucket-api-v2.git",

"babili": "^0.1.4",
"generic-test-generator": "github:kristianmandrup/generic-test-generator",
"babili-webpack-plugin": "^0.1.2",
"eslint": "^4.9.0",
"express": "^4.16.2",
"generic-test-generator": "github:kristianmandrup/generic-test-generator",
"nock": "^9.0.22",

@@ -49,2 +49,3 @@ "nyc": "^11.2.1",

"webpack": "^3.8.1",
"webpack-cli": "^2.1.2",
"webpack-merge": "^4.1.0"

@@ -51,0 +52,0 @@ },

@@ -31,2 +31,7 @@ const {

bitbucketApi.authenticateOAuth2(opts.accessToken)
} else if (opts.basicAuth) {
bitbucketApi.authenticateBasic(
opts.basicAuth.username,
opts.basicAuth.password
)
}

@@ -92,2 +97,11 @@ return bitbucketApi

apiModel.authenticateBasic = (username, password) => {
apiModel.request
.setOption('login_type', 'basic')
.setOption('username', username)
.setOption('password', password)
return apiModel
}
/**

@@ -94,0 +108,0 @@ * Deauthenticate a user for all next requests

2

src/index.js

@@ -16,3 +16,3 @@ const {

Bitbucket,
createBitBucketAPI,
createBitbucketAPI,
createBitBucketAPI: createBitbucketAPI, // alias

@@ -19,0 +19,0 @@ createAuthenticatedAPI,

@@ -320,2 +320,4 @@ const _ = require('lodash')

jwt_access_token: jwtAccessToken,
username: _user,
password: _pass,
proxy_host: proxyHost,

@@ -329,9 +331,14 @@ proxy_port: proxyPort,

// console.log('prepRequest', options)
const authBearerToken = oauthAccessToken || jwtAccessToken || '<none>'
const authBearerToken = oauthAccessToken || jwtAccessToken || null
const basicAuthToken = _user && _pass ?
Buffer.from(`${_user}:${_pass}`).toString('base64') : null
const headers = {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: `Bearer ${authBearerToken}`
Authorization: '<none>'
}
if (basicAuthToken) headers.Authorization = `Basic ${basicAuthToken}`
else if (authBearerToken) headers.Authorization = `Bearer ${authBearerToken}`
if (!useXhr) {

@@ -338,0 +345,0 @@ headers['Host'] = 'api.bitbucket.org' // eslint-disable-line dot-notation

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc