@heroku-cli/command
Advanced tools
Comparing version 8.1.13 to 8.1.14
@@ -0,1 +1,9 @@ | ||
<a name="8.1.14"></a> | ||
## [8.1.14](https://github.com/heroku/heroku-cli-command/compare/v8.1.13...v8.1.14) (2018-05-10) | ||
### Bug Fixes | ||
* do login first to fix sso login with browser ([1785ded](https://github.com/heroku/heroku-cli-command/commit/1785ded)) | ||
<a name="8.1.13"></a> | ||
@@ -2,0 +10,0 @@ ## [8.1.13](https://github.com/heroku/heroku-cli-command/compare/v8.1.12...v8.1.13) (2018-05-10) |
@@ -45,14 +45,10 @@ "use strict"; | ||
} | ||
try { | ||
if (previousEntry && previousEntry.password) | ||
await this.logout(previousEntry.password); | ||
} | ||
catch (err) { | ||
cli_ux_1.default.warn(err); | ||
} | ||
let auth; | ||
const logout = async () => { | ||
if (previousEntry && previousEntry.password) { | ||
try { | ||
await this.logout(previousEntry.password); | ||
delete previousEntry.password; | ||
} | ||
catch (err) { | ||
cli_ux_1.default.warn(err); | ||
} | ||
} | ||
}; | ||
switch (input) { | ||
@@ -69,3 +65,2 @@ case 'b': | ||
case 'sso': | ||
await logout(); // for sso logout first | ||
auth = await this.sso(previousEntry && previousEntry.org); | ||
@@ -77,3 +72,2 @@ break; | ||
await this.saveToken(auth); | ||
await logout(); | ||
} | ||
@@ -93,3 +87,3 @@ catch (err) { | ||
// authorizations because they are created a trusted client | ||
requests.push(http_call_1.default.delete(`${vars_1.vars.apiUrl}/oauth/sessions/~`, headers(this.heroku.auth)) | ||
requests.push(http_call_1.default.delete(`${vars_1.vars.apiUrl}/oauth/sessions/~`, headers(token)) | ||
.catch(err => { | ||
@@ -109,3 +103,3 @@ if (!err.http) | ||
// the ~ is the API Key, not the authorization that is currently requesting | ||
requests.push(http_call_1.default.get(`${vars_1.vars.apiUrl}/oauth/authorizations`, headers(this.heroku.auth)) | ||
requests.push(http_call_1.default.get(`${vars_1.vars.apiUrl}/oauth/authorizations`, headers(token)) | ||
.then(async ({ body: authorizations }) => { | ||
@@ -120,3 +114,3 @@ // grab the default authorization because that is the token shown in the | ||
.filter(a => a.access_token && a.access_token.token !== this.heroku.auth) | ||
.map(a => http_call_1.default.delete(`${vars_1.vars.apiUrl}/oauth/authorizations/${a.id}`, headers(this.heroku.auth)))); | ||
.map(a => http_call_1.default.delete(`${vars_1.vars.apiUrl}/oauth/authorizations/${a.id}`, headers(token)))); | ||
}) | ||
@@ -123,0 +117,0 @@ .catch(err => { |
{ | ||
"name": "@heroku-cli/command", | ||
"description": "base class for Heroku CLI commands", | ||
"version": "8.1.13", | ||
"version": "8.1.14", | ||
"author": "Jeff Dickey @jdxcode", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/heroku/heroku-cli-command/issues", |
51459
1168