passport-bitbucket-token
Advanced tools
Comparing version 0.2.0 to 1.0.0
@@ -89,3 +89,3 @@ 'use strict'; | ||
var emailUrlPath = this._apiVersion === '2.0' ? 'https://api.bitbucket.org/2.0/user/emails' : 'https://api.bitbucket.org/1.0/users/' + accountName + '/emails'; | ||
var emailUrlPath = this.isApiV1() ? 'https://api.bitbucket.org/1.0/users/' + accountName + '/emails' : 'https://api.bitbucket.org/2.0/user/emails'; | ||
var emailUrl = _url2.default.parse(emailUrlPath); | ||
@@ -98,5 +98,4 @@ | ||
var json = JSON.parse(body); | ||
profile.emails = _this3.isApiV1() ? _v1Profile2.default.emails(json) : _v2Profile2.default.emails(json); | ||
profile.emails = _this3._apiVersion === '2.0' ? _v2Profile2.default.emails(json) : _v1Profile2.default.emails(json); | ||
console.log(profile); | ||
done(null, profile); | ||
@@ -109,2 +108,7 @@ } catch (e) { | ||
}, { | ||
key: 'isApiV1', | ||
value: function isApiV1() { | ||
return this._apiVersion === '1.0'; | ||
} | ||
}, { | ||
key: 'userProfile', | ||
@@ -122,3 +126,3 @@ value: function userProfile(accessToken, done) { | ||
var profile = _this4._apiVersion === '1.0' ? _v1Profile2.default.profile(json, body) : _v2Profile2.default.profile(json, body); | ||
var profile = _this4.isApiV1() ? _v1Profile2.default.profile(json, body) : _v2Profile2.default.profile(json, body); | ||
@@ -125,0 +129,0 @@ if (_this4._profileWithEmail) { |
{ | ||
"name": "passport-bitbucket-token", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"description": "Passport strategy for authenticating with Bitbucket access tokens using the OAuth 2.0 API.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -83,2 +83,48 @@ # passport-bitbucket-token | ||
### Profile examples | ||
In this section we will show examples of parsed profile that are returned to `verify` callback. | ||
#### Bitbucket API v1.0 | ||
```js | ||
{ | ||
provider: 'bitbucket', | ||
id: 'john_doe', | ||
username: 'john_doe', | ||
name: { first_name: 'John', last_name: 'Doe' }, | ||
emails: [{value: 'test@example.com', primary: true, verified: true}] | ||
avatar: 'https://bitbucket.org/account/john_doe/avatar/32/?ts=1492462087', | ||
_raw: 'raw json object from Bitbucket server', | ||
_json: | ||
{ | ||
'parsed json object from server' | ||
} | ||
} | ||
``` | ||
#### Bitbucket API v2.0 | ||
```js | ||
{ | ||
provider: 'bitbucket', | ||
id: 'john_doe', | ||
username: 'john_doe', | ||
display_name: 'John Doe', | ||
emails: [{value: 'test@example.com', primary: true, verified: true}] | ||
avatar: 'https://bitbucket.org/account/john_doe/avatar/32/?ts=1492462087', | ||
_raw: 'raw json object from Bitbucket server', | ||
_json: | ||
{ | ||
'parsed json object from server' | ||
} | ||
} | ||
``` | ||
# Examples | ||
Example of server application can be found [here](https://github.com/GenFirst/passport-bitbucket-token/tree/master/example/backend). | ||
Full example of React.js + Node.js/Express.js can be found [here](https://github.com/GenFirst/react-node-bitbucket-login). | ||
# License | ||
@@ -85,0 +131,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
88422
169
1
133