@octokit/auth-app
Advanced tools
Comparing version 2.4.0 to 2.4.1
@@ -11,2 +11,3 @@ 'use strict'; | ||
var LRU = _interopDefault(require('lru-cache')); | ||
var requestError = require('@octokit/request-error'); | ||
@@ -186,2 +187,11 @@ async function getAppAuthentication(id, privateKey) { | ||
}; | ||
const response = await request(route, parameters); | ||
if (response.data.error !== undefined) { | ||
throw new requestError.RequestError(`${response.data.error_description} (${response.data.error})`, response.status, { | ||
headers: response.headers, | ||
request: request.endpoint(route, parameters) | ||
}); | ||
} | ||
const { | ||
@@ -192,3 +202,3 @@ data: { | ||
} | ||
} = await request(route, parameters); | ||
} = response; | ||
return { | ||
@@ -265,3 +275,3 @@ type: "token", | ||
const VERSION = '2.4.0'; | ||
const VERSION = '2.4.1'; | ||
@@ -268,0 +278,0 @@ const createAppAuth = function createAppAuth(options) { |
@@ -0,1 +1,2 @@ | ||
import { RequestError } from '@octokit/request-error'; | ||
export async function getOAuthAuthentication(state, options, customRequest) { | ||
@@ -18,3 +19,10 @@ const request = customRequest || state.request; | ||
}; | ||
const { data: { access_token: token, scope } } = await request(route, parameters); | ||
const response = await request(route, parameters); | ||
if (response.data.error !== undefined) { | ||
throw new RequestError(`${response.data.error_description} (${response.data.error})`, response.status, { | ||
headers: response.headers, | ||
request: request.endpoint(route, parameters) | ||
}); | ||
} | ||
const { data: { access_token: token, scope } } = response; | ||
return { | ||
@@ -21,0 +29,0 @@ type: "token", |
@@ -1,1 +0,1 @@ | ||
export const VERSION = '2.4.0'; | ||
export const VERSION = '2.4.1'; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.4.0"; | ||
export declare const VERSION = "2.4.1"; |
@@ -5,2 +5,3 @@ import { getUserAgent } from 'universal-user-agent'; | ||
import LRU from 'lru-cache'; | ||
import { RequestError } from '@octokit/request-error'; | ||
@@ -162,3 +163,10 @@ async function getAppAuthentication(id, privateKey) { | ||
}; | ||
const { data: { access_token: token, scope } } = await request(route, parameters); | ||
const response = await request(route, parameters); | ||
if (response.data.error !== undefined) { | ||
throw new RequestError(`${response.data.error_description} (${response.data.error})`, response.status, { | ||
headers: response.headers, | ||
request: request.endpoint(route, parameters) | ||
}); | ||
} | ||
const { data: { access_token: token, scope } } = response; | ||
return { | ||
@@ -239,3 +247,3 @@ type: "token", | ||
const VERSION = '2.4.0'; | ||
const VERSION = '2.4.1'; | ||
@@ -242,0 +250,0 @@ const createAppAuth = function createAppAuth(options) { |
{ | ||
"name": "@octokit/auth-app", | ||
"description": "GitHub App authentication for JavaScript", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"license": "MIT", | ||
@@ -26,2 +26,3 @@ "files": [ | ||
"@octokit/types": "^2.0.0", | ||
"@octokit/request-error": "^1.1.0", | ||
"@types/lru-cache": "^5.1.0", | ||
@@ -28,0 +29,0 @@ "lru-cache": "^5.1.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
88824
882
7
+ Added@octokit/request-error@1.2.1(transitive)