Socket
Socket
Sign inDemoInstall

@octokit/auth-oauth-app

Package Overview
Dependencies
Maintainers
4
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 5.0.4 to 5.0.5

32

dist-node/index.js

@@ -24,3 +24,2 @@ 'use strict';

}
if ("factory" in authOptions) {

@@ -30,9 +29,9 @@ const {

...options
} = { ...authOptions,
} = {
...authOptions,
...state
}; // @ts-expect-error TODO: `option` cannot be never, is this a bug?
};
// @ts-expect-error TODO: `option` cannot be never, is this a bug?
return authOptions.factory(options);
}
const common = {

@@ -43,7 +42,9 @@ clientId: state.clientId,

...authOptions
}; // TS: Look what you made me do
const userAuth = state.clientType === "oauth-app" ? await authOauthUser.createOAuthUserAuth({ ...common,
};
// TS: Look what you made me do
const userAuth = state.clientType === "oauth-app" ? await authOauthUser.createOAuthUserAuth({
...common,
clientType: state.clientType
}) : await authOauthUser.createOAuthUserAuth({ ...common,
}) : await authOauthUser.createOAuthUserAuth({
...common,
clientType: state.clientType

@@ -55,15 +56,12 @@ });

async function hook(state, request, route, parameters) {
let endpoint = request.endpoint.merge(route, parameters); // Do not intercept OAuth Web/Device flow request
let endpoint = request.endpoint.merge(route, parameters);
// Do not intercept OAuth Web/Device flow request
if (/\/login\/(oauth\/access_token|device\/code)$/.test(endpoint.url)) {
return request(endpoint);
}
if (state.clientType === "github-app" && !authOauthUser.requiresBasicAuth(endpoint.url)) {
throw new Error(`[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than "/applications/{client_id}/**". "${endpoint.method} ${endpoint.url}" is not supported.`);
}
const credentials = btoa(`${state.clientId}:${state.clientSecret}`);
endpoint.headers.authorization = `basic ${credentials}`;
try {

@@ -79,3 +77,3 @@ return await request(endpoint);

const VERSION = "5.0.4";
const VERSION = "5.0.5";

@@ -90,4 +88,4 @@ function createOAuthAppAuth(options) {

clientType: "oauth-app"
}, options); // @ts-expect-error not worth the extra code to appease TS
}, options);
// @ts-expect-error not worth the extra code to appease TS
return Object.assign(auth.bind(null, state), {

@@ -94,0 +92,0 @@ hook: hook.bind(null, state)

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

export const VERSION = "5.0.4";
export const VERSION = "5.0.5";
import { EndpointOptions, RequestParameters, Route, RequestInterface, OctokitResponse } from "@octokit/types";
import * as AuthOAuthUser from "@octokit/auth-oauth-user";
import * as DeviceTypes from "@octokit/auth-oauth-device";
export declare type ClientType = "oauth-app" | "github-app";
export declare type OAuthAppStrategyOptions = {
export type ClientType = "oauth-app" | "github-app";
export type OAuthAppStrategyOptions = {
clientType?: "oauth-app";

@@ -11,3 +11,3 @@ clientId: string;

};
export declare type GitHubAppStrategyOptions = {
export type GitHubAppStrategyOptions = {
clientType: "github-app";

@@ -18,6 +18,6 @@ clientId: string;

};
export declare type AppAuthOptions = {
export type AppAuthOptions = {
type: "oauth-app";
};
export declare type WebFlowAuthOptions = {
export type WebFlowAuthOptions = {
type: "oauth-user";

@@ -28,3 +28,3 @@ code: string;

};
export declare type OAuthAppDeviceFlowAuthOptions = {
export type OAuthAppDeviceFlowAuthOptions = {
type: "oauth-user";

@@ -34,7 +34,7 @@ onVerification: DeviceTypes.OAuthAppStrategyOptions["onVerification"];

};
export declare type GitHubAppDeviceFlowAuthOptions = {
export type GitHubAppDeviceFlowAuthOptions = {
type: "oauth-user";
onVerification: DeviceTypes.OAuthAppStrategyOptions["onVerification"];
};
export declare type AppAuthentication = {
export type AppAuthentication = {
type: "oauth-app";

@@ -48,13 +48,13 @@ clientId: string;

};
export declare type OAuthAppUserAuthentication = AuthOAuthUser.OAuthAppAuthentication;
export declare type GitHubAppUserAuthentication = AuthOAuthUser.GitHubAppAuthentication;
export declare type GitHubAppUserAuthenticationWithExpiration = AuthOAuthUser.GitHubAppAuthenticationWithExpiration;
export declare type FactoryOAuthAppWebFlowOptions = OAuthAppStrategyOptions & Omit<WebFlowAuthOptions, "type"> & {
export type OAuthAppUserAuthentication = AuthOAuthUser.OAuthAppAuthentication;
export type GitHubAppUserAuthentication = AuthOAuthUser.GitHubAppAuthentication;
export type GitHubAppUserAuthenticationWithExpiration = AuthOAuthUser.GitHubAppAuthenticationWithExpiration;
export type FactoryOAuthAppWebFlowOptions = OAuthAppStrategyOptions & Omit<WebFlowAuthOptions, "type"> & {
clientType: "oauth-app";
};
export declare type FactoryOAuthAppDeviceFlowOptions = OAuthAppStrategyOptions & Omit<OAuthAppDeviceFlowAuthOptions, "type"> & {
export type FactoryOAuthAppDeviceFlowOptions = OAuthAppStrategyOptions & Omit<OAuthAppDeviceFlowAuthOptions, "type"> & {
clientType: "oauth-app";
};
export declare type FactoryGitHubAppWebFlowOptions = GitHubAppStrategyOptions & Omit<WebFlowAuthOptions, "type">;
export declare type FactoryGitHubAppDeviceFlowOptions = GitHubAppStrategyOptions & Omit<GitHubAppDeviceFlowAuthOptions, "type">;
export type FactoryGitHubAppWebFlowOptions = GitHubAppStrategyOptions & Omit<WebFlowAuthOptions, "type">;
export type FactoryGitHubAppDeviceFlowOptions = GitHubAppStrategyOptions & Omit<GitHubAppDeviceFlowAuthOptions, "type">;
export interface FactoryOAuthAppWebFlow<T> {

@@ -96,9 +96,9 @@ (options: FactoryOAuthAppWebFlowOptions): T;

}
export declare type OAuthAppState = OAuthAppStrategyOptions & {
export type OAuthAppState = OAuthAppStrategyOptions & {
clientType: "oauth-app";
request: RequestInterface;
};
export declare type GitHubAppState = GitHubAppStrategyOptions & {
export type GitHubAppState = GitHubAppStrategyOptions & {
clientType: "github-app";
request: RequestInterface;
};

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

export declare const VERSION = "5.0.4";
export declare const VERSION = "5.0.5";

@@ -69,3 +69,3 @@ import { getUserAgent } from 'universal-user-agent';

const VERSION = "5.0.4";
const VERSION = "5.0.5";

@@ -72,0 +72,0 @@ function createOAuthAppAuth(options) {

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

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

"@octokit/request": "^6.0.0",
"@octokit/types": "^8.0.0",
"@octokit/types": "^9.0.0",
"@types/btoa-lite": "^1.0.0",

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

"jest": "^29.0.0",
"prettier": "2.7.1",
"prettier": "2.8.3",
"semantic-release-plugin-update-version-in-files": "^1.0.0",

@@ -47,0 +47,0 @@ "ts-jest": "^29.0.0",

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