Socket
Socket
Sign inDemoInstall

@octokit/auth-oauth-app

Package Overview
Dependencies
Maintainers
3
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/auth-oauth-app - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

16

dist-node/index.js

@@ -13,11 +13,5 @@ 'use strict';

async function getOAuthAccessToken(state, options) {
var _a, _b, _c, _d;
/* istanbul ignore next: coverage probles with optional chaning */
const authOptionsPassed = options.auth ? typeof options.auth.code !== "undefined" : false;
const authOptions = options.auth && authOptionsPassed ? options.auth : state;
const authOptionsPassed = typeof ((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.code) !== "undefined";
const authOptions = authOptionsPassed ?
/* istanbul ignore next: coverage probles with optional chaning */
(_c = options) === null || _c === void 0 ? void 0 : _c.auth : state;
if (state.token && !authOptionsPassed) {

@@ -30,5 +24,3 @@ return state.token;

const route = /^https:\/\/(api\.)?github\.com$/.test(state.request.endpoint.DEFAULTS.baseUrl) ? "POST https://github.com/login/oauth/access_token" : `POST ${state.request.endpoint.DEFAULTS.baseUrl.replace("/api/v3", "/login/oauth/access_token")}`;
/* istanbul ignore next: coverage probles with optional chaning */
const request = ((_d = options) === null || _d === void 0 ? void 0 : _d.request) || state.request;
const request = options.request || state.request;
const parameters = {

@@ -152,3 +144,3 @@ headers: {

const VERSION = "3.0.3";
const VERSION = "3.0.4";

@@ -155,0 +147,0 @@ function createOAuthAppAuth(options) {

import { RequestError } from "@octokit/request-error";
export async function getOAuthAccessToken(state, options) {
var _a, _b, _c, _d;
/* istanbul ignore next: coverage probles with optional chaning */
const authOptionsPassed = typeof ((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.code) !== "undefined";
const authOptions = authOptionsPassed
? /* istanbul ignore next: coverage probles with optional chaning */
(_c = options) === null || _c === void 0 ? void 0 : _c.auth
: state;
const authOptionsPassed = options.auth
? typeof options.auth.code !== "undefined"
: false;
const authOptions = options.auth && authOptionsPassed ? options.auth : state;
if (state.token && !authOptionsPassed) {

@@ -18,7 +15,6 @@ return state.token;

: `POST ${state.request.endpoint.DEFAULTS.baseUrl.replace("/api/v3", "/login/oauth/access_token")}`;
/* istanbul ignore next: coverage probles with optional chaning */
const request = ((_d = options) === null || _d === void 0 ? void 0 : _d.request) || state.request;
const request = options.request || state.request;
const parameters = {
headers: {
accept: "application/json"
accept: "application/json",
},

@@ -29,3 +25,3 @@ client_id: state.clientId,

redirect_uri: authOptions.redirectUrl,
state: authOptions.state
state: authOptions.state,
};

@@ -36,3 +32,3 @@ const response = await request(route, parameters);

headers: response.headers,
request: request.endpoint(route, parameters)
request: request.endpoint(route, parameters),
});

@@ -43,3 +39,3 @@ }

token: data.access_token,
scopes: data.scope.split(/,\s*/).filter(Boolean)
scopes: data.scope.split(/,\s*/).filter(Boolean),
};

@@ -46,0 +42,0 @@ if (!authOptionsPassed) {

@@ -1,1 +0,1 @@

export const VERSION = "3.0.3";
export const VERSION = "3.0.4";
import { AuthTokenOptions, RequestInterface, State, TokenWithScopes } from "./types";
export declare function getOAuthAccessToken(state: State, options?: {
export declare function getOAuthAccessToken(state: State, options: {
request?: RequestInterface;
auth?: AuthTokenOptions;
}): Promise<TokenWithScopes>;

@@ -1,1 +0,1 @@

export declare const VERSION = "3.0.3";
export declare const VERSION = "3.0.4";

@@ -7,9 +7,6 @@ import { getUserAgent } from 'universal-user-agent';

async function getOAuthAccessToken(state, options) {
var _a, _b, _c, _d;
/* istanbul ignore next: coverage probles with optional chaning */
const authOptionsPassed = typeof ((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.code) !== "undefined";
const authOptions = authOptionsPassed
? /* istanbul ignore next: coverage probles with optional chaning */
(_c = options) === null || _c === void 0 ? void 0 : _c.auth
: state;
const authOptionsPassed = options.auth
? typeof options.auth.code !== "undefined"
: false;
const authOptions = options.auth && authOptionsPassed ? options.auth : state;
if (state.token && !authOptionsPassed) {

@@ -23,7 +20,6 @@ return state.token;

: `POST ${state.request.endpoint.DEFAULTS.baseUrl.replace("/api/v3", "/login/oauth/access_token")}`;
/* istanbul ignore next: coverage probles with optional chaning */
const request = ((_d = options) === null || _d === void 0 ? void 0 : _d.request) || state.request;
const request = options.request || state.request;
const parameters = {
headers: {
accept: "application/json"
accept: "application/json",
},

@@ -34,3 +30,3 @@ client_id: state.clientId,

redirect_uri: authOptions.redirectUrl,
state: authOptions.state
state: authOptions.state,
};

@@ -41,3 +37,3 @@ const response = await request(route, parameters);

headers: response.headers,
request: request.endpoint(route, parameters)
request: request.endpoint(route, parameters),
});

@@ -48,3 +44,3 @@ }

token: data.access_token,
scopes: data.scope.split(/,\s*/).filter(Boolean)
scopes: data.scope.split(/,\s*/).filter(Boolean),
};

@@ -131,3 +127,3 @@ if (!authOptionsPassed) {

const VERSION = "3.0.3";
const VERSION = "3.0.4";

@@ -134,0 +130,0 @@ function createOAuthAppAuth(options) {

{
"name": "@octokit/auth-oauth-app",
"description": "GitHub OAuth App authentication for JavaScript",
"version": "3.0.3",
"version": "3.0.4",
"license": "MIT",

@@ -27,3 +27,3 @@ "files": [

"@octokit/request-error": "^2.0.0",
"@octokit/types": "^4.0.1",
"@octokit/types": "^5.0.0",
"@types/btoa-lite": "^1.0.0",

@@ -39,3 +39,3 @@ "btoa-lite": "^1.0.0",

"@types/fetch-mock": "^7.3.1",
"@types/jest": "^25.1.0",
"@types/jest": "^26.0.0",
"fetch-mock": "^9.0.0",

@@ -46,3 +46,3 @@ "jest": "^25.1.0",

"ts-jest": "^25.1.0",
"typescript": "^3.5.1"
"typescript": "^3.9.3"
},

@@ -49,0 +49,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc